public JaxBeanInfo getOrCreate(RuntimeTypeInfo e) { if(e instanceof RuntimeElementInfo) return getOrCreate((RuntimeElementInfo)e); if(e instanceof RuntimeClassInfo) return getOrCreate((RuntimeClassInfo)e); if(e instanceof RuntimeLeafInfo) { JaxBeanInfo bi = beanInfos.get(e); // must have been created assert bi!=null; return bi; } if(e instanceof RuntimeArrayInfo) return getOrCreate((RuntimeArrayInfo)e); if(e.getType()==Object.class) { // anyType JaxBeanInfo bi = beanInfoMap.get(Object.class); if(bi==null) { bi = new AnyTypeBeanInfo(this,e); beanInfoMap.put(Object.class,bi); } return bi; } throw new IllegalArgumentException(); }
public ArrayBeanInfoImpl(JAXBContextImpl owner, RuntimeArrayInfo rai) { super(owner,rai,rai.getType(), rai.getTypeName(), false, true, false); this.itemType = jaxbType.getComponentType(); this.itemBeanInfo = owner.getOrCreate(rai.getItemType()); }
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) { super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable()); this.prop = prop; List<? extends RuntimeTypeRef> types = prop.getTypes(); Name n = null; for (RuntimeTypeRef typeRef : types) { Class type = (Class)typeRef.getTarget().getType(); if(type.isPrimitive()) type = RuntimeUtil.primitiveToBox.get(type); JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget()); TagAndType tt = new TagAndType( grammar.nameBuilder.createElementName(typeRef.getTagName()), beanInfo); typeMap.put(type,tt); refs.put(typeRef,beanInfo); if(typeRef.isNillable() && n==null) n = tt.tagName; } nillableTagName = n; }
public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) { JAXBContextImpl context = chain.context; for (TypeRef<Type,Class> e : prop.getTypes()) { JaxBeanInfo bi = context.getOrCreate((RuntimeTypeInfo) e.getTarget()); // if the expected Java type is already final, type substitution won't really work anyway. // this also traps cases like trying to substitute xsd:long element with xsi:type='xsd:int' Loader l = bi.getLoader(context,!Modifier.isFinal(bi.jaxbType.getModifiers())); if(e.getDefaultValue()!=null) l = new DefaultValueLoaderDecorator(l,e.getDefaultValue()); if(nillable || chain.context.allNillable) l = new XsiNilLoader.Single(l,acc); handlers.put( e.getTagName(), new ChildLoader(l,acc)); } }
public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop) { super(p, prop, prop.getXmlName(), prop.isCollectionNillable()); for (RuntimeElement e : prop.getElements()) { JaxBeanInfo bi = p.getOrCreate(e); expectedElements.put( e.getElementName().getNamespaceURI(),e.getElementName().getLocalPart(), bi ); } isMixed = prop.isMixed(); if(prop.getWildcard()!=null) { domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler()); wcMode = prop.getWildcard(); } else { domHandler = null; wcMode = null; } }
JaxBeanInfo<?> bi = getOrCreate(e); for (QName qn : bi.getTypeNames()) typeMap.put( qn, bi ); JaxBeanInfo<?> ai = getOrCreate(a); for (QName qn : ai.getTypeNames()) typeMap.put( qn, ai ); ClassBeanInfoImpl<?> bi = getOrCreate(e.getValue()); ElementBeanInfoImpl bi = getOrCreate(n); if(n.getScope()==null) rootMap.put(n.getElementName(),bi); getOrCreate(typeSet.getAnyTypeInfo());
public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) { super(context,prop); acc = prop.getAccessor().optimize(context); this.prop = prop; QName nt = null; boolean nil = false; acceptedElements = new QName[prop.getTypes().size()]; for( int i=0; i<acceptedElements.length; i++ ) acceptedElements[i] = prop.getTypes().get(i).getTagName(); for (RuntimeTypeRef e : prop.getTypes()) { JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget()); if(nt==null) nt = e.getTagName(); typeNames.put( beanInfo.jaxbType, new TagAndType( context.nameBuilder.createElementName(e.getTagName()),beanInfo) ); nil |= e.isNillable(); } nullTagName = context.nameBuilder.createElementName(nt); nillable = nil; }
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) { super(context, prop); acc = prop.getAccessor().optimize(context); this.tagName = context.nameBuilder.createElementName(prop.getXmlName()); this.entryTag = context.nameBuilder.createElementName("","entry"); this.keyTag = context.nameBuilder.createElementName("","key"); this.valueTag = context.nameBuilder.createElementName("","value"); this.nillable = prop.isCollectionNillable(); this.keyBeanInfo = context.getOrCreate(prop.getKeyType()); this.valueBeanInfo = context.getOrCreate(prop.getValueType()); // infer the implementation class //noinspection unchecked Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()); mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses); // TODO: error check for mapImplClass==null // what is the error reporting path for this part of the code? }
this.superClazz = null; else this.superClazz = owner.getOrCreate(ci.getBaseClass());
public SingleReferenceNodeProperty(JAXBContextImpl context, RuntimeReferencePropertyInfo prop) { super(context,prop); acc = prop.getAccessor().optimize(context); for (RuntimeElement e : prop.getElements()) { expectedElements.put( e.getElementName(), context.getOrCreate(e) ); } if(prop.getWildcard()!=null) { domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler()); wcMode = prop.getWildcard(); } else { domHandler = null; wcMode = null; } }
public JaxBeanInfo getOrCreate(RuntimeTypeInfo e) { if(e instanceof RuntimeElementInfo) return getOrCreate((RuntimeElementInfo)e); if(e instanceof RuntimeClassInfo) return getOrCreate((RuntimeClassInfo)e); if(e instanceof RuntimeLeafInfo) { JaxBeanInfo bi = beanInfos.get(e); // must have been created assert bi!=null; return bi; } if(e instanceof RuntimeArrayInfo) return getOrCreate((RuntimeArrayInfo)e); if(e.getType()==Object.class) { // anyType JaxBeanInfo bi = beanInfoMap.get(Object.class); if(bi==null) { bi = new AnyTypeBeanInfo(this,e); beanInfoMap.put(Object.class,bi); } return bi; } throw new IllegalArgumentException(); }
public ArrayBeanInfoImpl(JAXBContextImpl owner, RuntimeArrayInfo rai) { super(owner,rai,rai.getType(), rai.getTypeName(), false, true, false); this.itemType = jaxbType.getComponentType(); this.itemBeanInfo = owner.getOrCreate(rai.getItemType()); }
protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) { super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable()); this.prop = prop; List<? extends RuntimeTypeRef> types = prop.getTypes(); Name n = null; for (RuntimeTypeRef typeRef : types) { Class type = (Class)typeRef.getTarget().getType(); if(type.isPrimitive()) type = RuntimeUtil.primitiveToBox.get(type); JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget()); TagAndType tt = new TagAndType( grammar.nameBuilder.createElementName(typeRef.getTagName()), beanInfo); typeMap.put(type,tt); refs.put(typeRef,beanInfo); if(typeRef.isNillable() && n==null) n = tt.tagName; } nillableTagName = n; }
public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap<ChildLoader> handlers) { JAXBContextImpl context = chain.context; for (TypeRef<Type,Class> e : prop.getTypes()) { JaxBeanInfo bi = context.getOrCreate((RuntimeTypeInfo) e.getTarget()); // if the expected Java type is already final, type substitution won't really work anyway. // this also traps cases like trying to substitute xsd:long element with xsi:type='xsd:int' Loader l = bi.getLoader(context,!Modifier.isFinal(bi.jaxbType.getModifiers())); if(e.getDefaultValue()!=null) l = new DefaultValueLoaderDecorator(l,e.getDefaultValue()); if(nillable || chain.context.allNillable) l = new XsiNilLoader.Single(l,acc); handlers.put( e.getTagName(), new ChildLoader(l,acc)); } }
public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop) { super(p, prop, prop.getXmlName(), prop.isCollectionNillable()); for (RuntimeElement e : prop.getElements()) { JaxBeanInfo bi = p.getOrCreate(e); expectedElements.put( e.getElementName().getNamespaceURI(),e.getElementName().getLocalPart(), bi ); } isMixed = prop.isMixed(); if(prop.getWildcard()!=null) { domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler()); wcMode = prop.getWildcard(); } else { domHandler = null; wcMode = null; } }
JaxBeanInfo<?> bi = getOrCreate(e); for (QName qn : bi.getTypeNames()) typeMap.put( qn, bi ); JaxBeanInfo<?> ai = getOrCreate(a); for (QName qn : ai.getTypeNames()) typeMap.put( qn, ai ); ClassBeanInfoImpl<?> bi = getOrCreate(e.getValue()); ElementBeanInfoImpl bi = getOrCreate(n); if(n.getScope()==null) rootMap.put(n.getElementName(),bi); getOrCreate(typeSet.getAnyTypeInfo());
public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) { super(context,prop); acc = prop.getAccessor().optimize(context); this.prop = prop; QName nt = null; boolean nil = false; acceptedElements = new QName[prop.getTypes().size()]; for( int i=0; i<acceptedElements.length; i++ ) acceptedElements[i] = prop.getTypes().get(i).getTagName(); for (RuntimeTypeRef e : prop.getTypes()) { JaxBeanInfo beanInfo = context.getOrCreate(e.getTarget()); if(nt==null) nt = e.getTagName(); typeNames.put( beanInfo.jaxbType, new TagAndType( context.nameBuilder.createElementName(e.getTagName()),beanInfo) ); nil |= e.isNillable(); } nullTagName = context.nameBuilder.createElementName(nt); nillable = nil; }
public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) { super(context, prop); acc = prop.getAccessor().optimize(context); this.tagName = context.nameBuilder.createElementName(prop.getXmlName()); this.entryTag = context.nameBuilder.createElementName("","entry"); this.keyTag = context.nameBuilder.createElementName("","key"); this.valueTag = context.nameBuilder.createElementName("","value"); this.nillable = prop.isCollectionNillable(); this.keyBeanInfo = context.getOrCreate(prop.getKeyType()); this.valueBeanInfo = context.getOrCreate(prop.getValueType()); // infer the implementation class //noinspection unchecked Class<ValueT> sig = (Class<ValueT>) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()); mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses); // TODO: error check for mapImplClass==null // what is the error reporting path for this part of the code? }
this.superClazz = null; else this.superClazz = owner.getOrCreate(ci.getBaseClass());
public SingleReferenceNodeProperty(JAXBContextImpl context, RuntimeReferencePropertyInfo prop) { super(context,prop); acc = prop.getAccessor().optimize(context); for (RuntimeElement e : prop.getElements()) { expectedElements.put( e.getElementName(), context.getOrCreate(e) ); } if(prop.getWildcard()!=null) { domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler()); wcMode = prop.getWildcard(); } else { domHandler = null; wcMode = null; } }