/* 809 */ if (valueProperty != null)
/* 810 */ throw new RuntimeException("@XmlValue seen on two properties: " + property.getName() + " and " + valueProperty.getName());
/* 811 */ valueProperty = property;
/* */ }
/* */
/* 815 */ XmlAnyElement xmlAnyElement = (XmlAnyElement)property.getUnderlyingAnnotation(XmlAnyElement.class);
/* 816 */ if (xmlAnyElement != null)
/* */ {
/* 818 */ if (this.trace)
/* 819 */ log.trace("Seen @XmlAnyElement for type=" + beanInfo.getName() + " property=" + property.getName());
/* 820 */ if ((wildcardProperty != null) && (seenXmlAnyElement))
/* 821 */ throw new RuntimeException("@XmlAnyElement seen on two properties: " + property.getName() + " and " + wildcardProperty.getName());
/* 822 */ wildcardProperty = property;
/* 823 */ seenXmlAnyElement = true;
/* */ }
/* 825 */ else if ((!seenXmlAnyElement) && (wildcardProperty == null) && (property.getType().getName().equals(Element.class.getName())))
/* */ {
/* 827 */ if (this.trace)
/* 828 */ log.trace("Using type=" + beanInfo.getName() + " property=" + property.getName() + " as the base wildcard");
/* 829 */ if (wildcardProperty != null)
/* 830 */ throw new RuntimeException("@XmlAnyElement seen on two properties: " + property.getName() + " and " + wildcardProperty.getName());
/* 831 */ wildcardProperty = property;
/* */ }
/* */
/* 835 */ XmlAttribute xmlAttribute = (XmlAttribute)property.getUnderlyingAnnotation(XmlAttribute.class);
/* 836 */ if (xmlAttribute != null)
/* */ {
/* 838 */ JBossXmlAttribute jbossXmlAttribute = (JBossXmlAttribute)property.getUnderlyingAnnotation(JBossXmlAttribute.class);
/* */
/* 840 */ QName qName = generateXmlName(property.getName(), this.attributeForm, xmlAttribute.namespace(), xmlAttribute.name());
/* */
/* 842 */ TypeInfo attributeTypeInfo = property.getType();
/* 843 */ if ((jbossXmlAttribute != null) && (jbossXmlAttribute.type() != Object.class))
/* 844 */ attributeTypeInfo = attributeTypeInfo.getTypeInfoFactory().getTypeInfo(jbossXmlAttribute.type());
/* 845 */ TypeBinding attributeType = resolveTypeBinding(attributeTypeInfo);
/* */
/* 847 */ AttributeHandler attributeHandler = new PropertyHandler(property, attributeTypeInfo);
/* */
/* 849 */ AttributeBinding attribute = new AttributeBinding(this.schemaBinding, qName, attributeType, attributeHandler);
/* 850 */ attribute.setRequired(xmlAttribute.required());
/* 851 */ typeBinding.addAttribute(attribute);
/* 852 */ if (this.trace) {
/* 853 */ log.trace("Bound attribute " + qName + " type=" + beanInfo.getName() + " property=" + property.getName() + " propertyType=" + attributeTypeInfo);
/* */ }
/* */ }
/* */
/* 857 */ if (determinePropertyOrder)
/* */ {
/* 860 */ if (xmlValue != null)
/* */ {
/* 862 */ if (this.trace)
/* 863 */ log.trace("Ignore not element @XmlValue for type=" + beanInfo.getName() + " property=" + property.getName());
/* 864 */ pop();
/* 865 */ continue;
/* */ }
/* */
/* 868 */ if (xmlAnyElement != null)
/* */ {
/* 870 */ if (this.trace)
/* 871 */ log.trace("Ignore not element @XmlAnyElement for type=" + beanInfo.getName() + " property=" + property.getName());
/* 872 */ pop();
/* 873 */ continue;
/* */ }
/* */
/* 876 */ if (xmlAttribute != null)
/* */ {
/* 878 */ if (this.trace)
/* 879 */ log.trace("Ignore not element @XmlAttribute for type=" + beanInfo.getName() + " property=" + property.getName());
/* 880 */ pop();
/* 881 */ continue;
/* */ }
/* */
/* 884 */ XmlTransient xmlTransient = (XmlTransient)property.getUnderlyingAnnotation(XmlTransient.class);
/* 885 */ if (xmlTransient != null)
/* */ {
/* 887 */ if (this.trace)
/* 888 */ log.trace("Ignore not element @XmlTransient for type=" + beanInfo.getName() + " property=" + property.getName());
/* 889 */ pop();
/* 890 */ continue;
/* */ }
/* */
/* 893 */ String name = property.getName();
/* 894 */ if ("class".equals(name))
/* */ {
/* 896 */ pop();
/* 897 */ continue;
/* */ }
/* */
/* 900 */ if (noElements)
/* */ {
/* 902 */ pop();
/* 903 */ continue;
/* */ }
/* */
/* 906 */ if (this.trace)
/* 907 */ log.trace("Element for type=" + beanInfo.getName() + " property=" + property.getName());
/* 908 */ propertyNames.add(property.getName());
/* */ }
/* */
/* 911 */ pop();
/* */ }
/* */
/* 914 */ if (determinePropertyOrder)
/* */ {
/* 916 */ if (accessOrder == XmlAccessOrder.ALPHABETICAL)
/* 917 */ Collections.sort(propertyNames);
/* 918 */ propertyOrder = (String[])propertyNames.toArray(new String[propertyNames.size()]);
/* */ }
/* */
/* */ }
/* */
/* 936 */ if (valueProperty != null)
/* */ {
/* 938 */ CharactersHandler charactersHandler = new ValueHandler(valueProperty);
/* 939 */ typeBinding.setSimpleType(charactersHandler);
/* */ }
/* 941 */ else if (this.trace) {
/* 942 */ log.trace("No value for type=" + beanInfo.getName());
/* */ }
/* 944 */ if (this.trace) {
/* 945 */ log.trace("PropertyOrder " + Arrays.asList(propertyOrder) + " for type=" + beanInfo.getName());
/* */ }
/* */
/* 949 */ typeBinding.setSimple(false);
/* 950 */ ModelGroupBinding model = null;
/* 951 */ if (allBinding)
/* */ {
/* 953 */ if (this.trace)
/* 954 */ log.trace("AllBinding for type=" + beanInfo.getName());
/* 955 */ model = new AllBinding(this.schemaBinding);
/* */ }
/* */ else
/* */ {
/* 959 */ if (this.trace)
/* 960 */ log.trace("SequenceBinding for type=" + beanInfo.getName());
/* 961 */ model = new SequenceBinding(this.schemaBinding);
/* */ }
/* 963 */ model.setHandler(BuilderParticleHandler.INSTANCE);
/* 964 */ ParticleBinding typeParticle = new ParticleBinding(model);
/* 965 */ typeParticle.setMinOccurs(1);
/* 966 */ typeParticle.setMaxOccurs(1);
/* 967 */ typeBinding.setParticle(typeParticle);
/* */
/* 969 */ if (typeInfo.isCollection())
/* */ {
/* 971 */ TypeInfo memberBaseType = findComponentType(typeInfo);
/* 972 */ JBossXmlModelGroup xmlModelGroup = (JBossXmlModelGroup)((ClassInfo)memberBaseType).getUnderlyingAnnotation(JBossXmlModelGroup.class);
/* */
/* 974 */ if ((xmlModelGroup != null) && (xmlModelGroup.particles().length > 0))
/* */ {
/* 976 */ if (this.trace) {
/* 977 */ log.trace("Item base type for " + typeInfo.getName() + " is " + memberBaseType.getName() + " and bound to repeatable choice");
/* */ }
/* */
/* 982 */ ModelGroupBinding choiceGroup = null;
/* 983 */ QName choiceName = null;
/* 984 */ if (!"##default".equals(xmlModelGroup.name()))
/* */ {
/* 986 */ choiceName = new QName(this.defaultNamespace, xmlModelGroup.name());
/* 987 */ choiceGroup = this.schemaBinding.getGroup(choiceName);
/* */ }
/* */
/* 990 */ if (choiceGroup == null)
/* */ {
/* 992 */ choiceGroup = new ChoiceBinding(this.schemaBinding);
/* 993 */ choiceGroup.setHandler(BuilderParticleHandler.INSTANCE);
/* 994 */ if (choiceName != null)
/* */ {
/* 996 */ choiceGroup.setQName(choiceName);
/* 997 */ this.schemaBinding.addGroup(choiceGroup.getQName(), choiceGroup);
/* */ }
/* */
/* 1000 */ ParticleBinding choiceParticle = new ParticleBinding(choiceGroup, 0, 1, true);
/* 1001 */ model.addParticle(choiceParticle);
/* */
/* 1003 */ for (JBossXmlModelGroup.Particle member : xmlModelGroup.particles())
/* */ {
/* 1005 */ XmlElement element = member.element();
/* 1006 */ QName memberQName = generateXmlName(element.name(), XmlNsForm.QUALIFIED, element.namespace(), null);
/* 1007 */ TypeInfo memberTypeInfo = typeInfo.getTypeInfoFactory().getTypeInfo(member.type());
/* */
/* 1009 */ boolean isCol = false;
/* 1010 */ if (memberTypeInfo.isCollection())
/* */ {
/* 1012 */ memberTypeInfo = findComponentType((ClassInfo)memberTypeInfo);
/* 1013 */ isCol = true;
/* */ }
/* */
/* 1016 */ TypeBinding memberTypeBinding = resolveTypeBinding(memberTypeInfo);
/* 1017 */ ElementBinding memberElement = createElementBinding(memberTypeInfo, memberTypeBinding, memberQName, false);
/* 1018 */ memberElement.setNillable(true);
/* 1019 */ ParticleBinding memberParticle = new ParticleBinding(memberElement, 0, 1, isCol);
/* 1020 */ choiceGroup.addParticle(memberParticle);
/* */
/* 1022 */ typeBinding.pushInterceptor(memberQName, ChildCollectionInterceptor.SINGLETON);
/* */ }
/* */ }
/* */ else
/* */ {
/* 1027 */ ParticleBinding choiceParticle = new ParticleBinding(choiceGroup, 0, 1, true);
/* 1028 */ model.addParticle(choiceParticle);
/* */ }
/* */
/* 1031 */ if (this.trace) {
/* 1032 */ log.trace("choices for " + typeBinding.getQName() + ": " + choiceGroup.getParticles());
/* */ }
/* */ }
/* */ }
/* */
/* 1037 */ AbstractPropertyHandler wildcardHandler = null;
/* 1038 */ if (wildcardProperty != null)
/* */ {
/* 1040 */ TypeInfo wildcardType = wildcardProperty.getType();
/* 1041 */ if (wildcardType.isCollection())
/* 1042 */ wildcardHandler = new CollectionPropertyWildcardHandler(wildcardProperty, wildcardType);
/* */ else {
/* 1044 */ wildcardHandler = new PropertyWildcardHandler(wildcardProperty, wildcardType);
/* */ }
/* */ }
/* */
/* 1048 */ for (String name : propertyOrder)
/* */ {
/* 1051 */ push(typeInfo, name);
/* */
/* 1053 */ PropertyInfo property = beanInfo.getProperty(name);
/* 1054 */ bindProperty(property, typeBinding, model, beanAdapterFactory, propertyOrder);
/* 1055 */ pop();
/* */ }
/* */
/* 1059 */ JBossXmlChild[] children = null;
/* 1060 */ JBossXmlChildren jbossXmlChildren = (JBossXmlChildren)typeInfo.getUnderlyingAnnotation(JBossXmlChildren.class);
/* 1061 */ if (jbossXmlChildren != null) {
/* 1062 */ children = jbossXmlChildren.value();
/* */ }
/* */ else {
/* 1065 */ JBossXmlChild jbossXmlChild = (JBossXmlChild)typeInfo.getUnderlyingAnnotation(JBossXmlChild.class);
/* 1066 */ if (jbossXmlChild != null) {
/* 1067 */ children = new JBossXmlChild[] { jbossXmlChild };
/* */ }
/* */ }
/* 1070 */ if ((children != null) && (children.length > 0))
/* */ {
/* 1072 */ for (JBossXmlChild child : children)
/* */ {
/* 1074 */ QName qName = generateXmlName(child.name(), this.elementForm, child.namespace(), child.name());
/* 1075 */ TypeInfo childType = JBossXBBuilder.configuration.getTypeInfo(child.type());
/* */
/* 1077 */ TypeBinding elementTypeBinding = resolveTypeBinding(childType);
/* 1078 */ ElementBinding elementBinding = createElementBinding(childType, elementTypeBinding, qName, false);
/* */
/* 1081 */ ParticleBinding particle = new ParticleBinding(elementBinding, child.minOccurs(), child.maxOccurs(), child.unbounded());
/* 1082 */ model.addParticle(particle);
/* */
/* 1084 */ DefaultElementInterceptor interceptor = null;
/* 1085 */ if (typeInfo.isCollection()) {
/* 1086 */ interceptor = ChildCollectionInterceptor.SINGLETON;
/* */ }
/* */ else
/* */ {
/* 1090 */ PropertyInfo property = beanInfo.getProperty("value");
/* 1091 */ if (property == null)
/* 1092 */ throw new UnsupportedOperationException("Expected a value property for non-collection type with JBossXmlChildren");
/* 1093 */ TypeInfo propertyType = property.getType();
/* 1094 */ interceptor = new PropertyInterceptor(property, propertyType);
/* */ }
/* 1096 */ typeBinding.pushInterceptor(qName, interceptor);
/* 1097 */ if (this.trace) {
/* 1098 */ log.trace("Added interceptor " + qName + " for type=" + childType + " interceptor=" + interceptor);
/* */ }
/* */ }
/* */ }
/* */
/* 1103 */ if (wildcardProperty != null)
/* */ {
/* 1105 */ if (this.trace)
/* 1106 */ log.trace("Processing WildcardProperty for type=" + beanInfo.getName() + " property=" + wildcardProperty.getName());
/* 1107 */ ModelGroupBinding localModel = model;
/* 1108 */ TypeInfo wildcardType = wildcardProperty.getType();
/* 1109 */ TypeInfo type = wildcardType;
/* */
/* 1112 */ if (wildcardType.isArray())
/* */ {
/* 1114 */ localModel = createArray(localModel);
/* 1115 */ type = ((ArrayInfo)wildcardType).getComponentType();
/* 1116 */ if (this.trace)
/* 1117 */ log.trace("Wildcard " + wildcardProperty.getName() + " is an array of type " + type.getName());
/* */ }
/* 1119 */ else if (wildcardType.isCollection())
/* */ {
/* 1121 */ localModel = createCollection(localModel);
/* 1122 */ type = findComponentType(wildcardProperty);
/* 1123 */ if (this.trace) {
/* 1124 */ log.trace("Wildcard " + wildcardProperty.getName() + " is a collection of type " + type.getName());
/* */ }
/* */ }
/* 1127 */ XmlAnyElement xmlAnyElement = (XmlAnyElement)wildcardProperty.getUnderlyingAnnotation(XmlAnyElement.class);
/* 1128 */ boolean isLax = xmlAnyElement == null ? true : xmlAnyElement.lax();
/* 1129 */ WildcardBinding wildcard = new WildcardBinding(this.schemaBinding);
/* 1130 */ if (isLax)
/* 1131 */ wildcard.setProcessContents(3);
/* */ else {
/* 1133 */ wildcard.setProcessContents(1);