src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java

Print this page




1051                 children.add(new Tree.Term() {
1052                     protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
1053                         LocalElement e = parent.element();
1054 
1055                         QName tn = t.getTagName();
1056 
1057                         PropertyInfo propInfo = t.getSource();
1058                         TypeInfo parentInfo = (propInfo == null) ? null : propInfo.parent();
1059 
1060                         if (canBeDirectElementRef(t, tn, parentInfo)) {
1061                             if ((!t.getTarget().isSimpleType()) && (t.getTarget() instanceof ClassInfo) && collisionChecker.findDuplicate((ClassInfo<T, C>) t.getTarget())) {
1062                                 e.ref(new QName(uri, tn.getLocalPart()));
1063                             } else {
1064 
1065                                 QName elemName = null;
1066                                 if (t.getTarget() instanceof Element) {
1067                                     Element te = (Element) t.getTarget();
1068                                     elemName = te.getElementName();
1069                                 }
1070 
1071                                 Collection refs = propInfo.ref();
1072                                 if ((refs != null) && (!refs.isEmpty()) && (elemName != null)) {
1073                                     ClassInfoImpl cImpl = (ClassInfoImpl)refs.iterator().next();


1074                                     if ((cImpl != null) && (cImpl.getElementName() != null)) {
1075                                         e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart()));
1076                                     } else {
1077                                         e.ref(new QName("", tn.getLocalPart()));
1078                                     }
1079                                 } else {
1080                                     e.ref(tn);
1081                                 }
1082                             }
1083                         } else {
1084                             e.name(tn.getLocalPart());
1085                             writeTypeRef(e,t, "type");
1086                             elementFormDefault.writeForm(e,tn);
1087                         }
1088 
1089                         if (t.isNillable()) {
1090                             e.nillable(true);
1091                         }
1092                         if(t.getDefaultValue()!=null)
1093                             e._default(t.getDefaultValue());




1051                 children.add(new Tree.Term() {
1052                     protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) {
1053                         LocalElement e = parent.element();
1054 
1055                         QName tn = t.getTagName();
1056 
1057                         PropertyInfo propInfo = t.getSource();
1058                         TypeInfo parentInfo = (propInfo == null) ? null : propInfo.parent();
1059 
1060                         if (canBeDirectElementRef(t, tn, parentInfo)) {
1061                             if ((!t.getTarget().isSimpleType()) && (t.getTarget() instanceof ClassInfo) && collisionChecker.findDuplicate((ClassInfo<T, C>) t.getTarget())) {
1062                                 e.ref(new QName(uri, tn.getLocalPart()));
1063                             } else {
1064 
1065                                 QName elemName = null;
1066                                 if (t.getTarget() instanceof Element) {
1067                                     Element te = (Element) t.getTarget();
1068                                     elemName = te.getElementName();
1069                                 }
1070 
1071                                 Collection<TypeInfo> refs = propInfo.ref();
1072                                 TypeInfo ti;
1073                                 if ((refs != null) && (!refs.isEmpty()) && (elemName != null)
1074                                         && ((ti = refs.iterator().next()) == null || ti instanceof ClassInfoImpl)) {
1075                                     ClassInfoImpl cImpl = (ClassInfoImpl)ti;
1076                                     if ((cImpl != null) && (cImpl.getElementName() != null)) {
1077                                         e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart()));
1078                                     } else {
1079                                         e.ref(new QName("", tn.getLocalPart()));
1080                                     }
1081                                 } else {
1082                                     e.ref(tn);
1083                                 }
1084                             }
1085                         } else {
1086                             e.name(tn.getLocalPart());
1087                             writeTypeRef(e,t, "type");
1088                             elementFormDefault.writeForm(e,tn);
1089                         }
1090 
1091                         if (t.isNillable()) {
1092                             e.nillable(true);
1093                         }
1094                         if(t.getDefaultValue()!=null)
1095                             e._default(t.getDefaultValue());