public final <T> Accessor<BeanT, T> adapt(Adapter<Type, Class> adapter) { return new AdaptedAccessor<BeanT, ValueT, T>( (Class<T>) Utils.REFLECTION_NAVIGATOR.erasure(adapter.defaultType), this, adapter.adapterType); }
public Class<? extends JAXBElement> getType() { //noinspection unchecked return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType()); }
/** * Returns a {@link TypeInfo} for the given type. * * @return * null if the specified type cannot be bound by JAXB, or * not known to this set. */ public NonElement<T,C> getTypeInfo( T type ) { type = nav.erasure(type); // replace type variables by their bounds LeafInfo<T,C> l = builtins.get(type); if(l!=null) return l; if( nav.isArray(type) ) { return arrays.get(type); } C d = nav.asDecl(type); if(d==null) return null; return getClassInfo(d); }
Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Type bt = Utils.REFLECTION_NAVIGATOR.getBaseClass(fieldType,Collection.class); if(bt instanceof ParameterizedType) itemType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]); else itemType = Object.class;
ElementBeanInfoImpl(JAXBContextImpl grammar, RuntimeElementInfo rei) { super(grammar,rei,(Class<JAXBElement>)rei.getType(),true,false,true); this.property = PropertyFactory.create(grammar,rei.getProperty()); tagName = rei.getElementName(); expectedType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getContentInMemoryType()); scope = rei.getScope()==null ? JAXBElement.GlobalScope.class : rei.getScope().getClazz(); Class type = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getType()); if(type==JAXBElement.class) constructor = null; else { try { constructor = type.getConstructor(expectedType); } catch (NoSuchMethodException e) { NoSuchMethodError x = new NoSuchMethodError("Failed to find the constructor for " + type + " with " + expectedType); x.initCause(e); throw x; } } }
protected ArrayProperty(JAXBContextImpl context, RuntimePropertyInfo prop) { super(context,prop); assert prop.isCollection(); lister = Lister.create( Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()),prop.id(),prop.getAdapter()); assert lister!=null; acc = prop.getAccessor().optimize(context); assert acc!=null; }
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? }
public Class<? extends JAXBElement> getType() { //noinspection unchecked return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType()); }
public final <T> Accessor<BeanT, T> adapt(Adapter<Type, Class> adapter) { return new AdaptedAccessor<BeanT, ValueT, T>( (Class<T>) Utils.REFLECTION_NAVIGATOR.erasure(adapter.defaultType), this, adapter.adapterType); }
/** * Gets the {@link TransducedAccessor} appropriately configured for * the given property. * * <p> * This allows the implementation to use an optimized code. */ public static <T> TransducedAccessor<T> get(JAXBContextImpl context, RuntimeNonElementRef ref) { Transducer xducer = RuntimeModelBuilder.createTransducer(ref); RuntimePropertyInfo prop = ref.getSource(); if(prop.isCollection()) { return new ListTransducedAccessorImpl(xducer,prop.getAccessor(), Lister.create(Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()), prop.id(), prop.getAdapter())); } if(prop.id()==ID.IDREF) return new IDREFTransducedAccessorImpl(prop.getAccessor()); if(xducer.useNamespace()) return new CompositeContextDependentTransducedAccessorImpl( context, xducer, prop.getAccessor() ); else return new CompositeTransducedAccessorImpl( context, xducer, prop.getAccessor() ); }
T type = reader.getClassValue(r,"type"); if(nav().isSameType(type, defaultType)) type = nav.erasure(getIndividualType()); if(nav.getBaseClass(type,je)!=null) yield = addGenericElement(r); T type = reader.getClassValue(r,"type"); if (nav().isSameType(type, defaultType)) { type = nav.erasure(getIndividualType());
/** * Returns a {@link TypeInfo} for the given type. * * @return * null if the specified type cannot be bound by JAXB, or * not known to this set. */ public NonElement<T,C> getTypeInfo( T type ) { type = nav.erasure(type); // replace type variables by their bounds LeafInfo<T,C> l = builtins.get(type); if(l!=null) return l; if( nav.isArray(type) ) { return arrays.get(type); } C d = nav.asDecl(type); if(d==null) return null; return getClassInfo(d); }
Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Type bt = Utils.REFLECTION_NAVIGATOR.getBaseClass(fieldType,Collection.class); if(bt instanceof ParameterizedType) itemType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]); else itemType = Object.class;
ElementBeanInfoImpl(JAXBContextImpl grammar, RuntimeElementInfo rei) { super(grammar,rei,(Class<JAXBElement>)rei.getType(),true,false,true); this.property = PropertyFactory.create(grammar,rei.getProperty()); tagName = rei.getElementName(); expectedType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getContentInMemoryType()); scope = rei.getScope()==null ? JAXBElement.GlobalScope.class : rei.getScope().getClazz(); Class type = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getType()); if(type==JAXBElement.class) constructor = null; else { try { constructor = type.getConstructor(expectedType); } catch (NoSuchMethodException e) { NoSuchMethodError x = new NoSuchMethodError("Failed to find the constructor for " + type + " with " + expectedType); x.initCause(e); throw x; } } }
protected ArrayProperty(JAXBContextImpl context, RuntimePropertyInfo prop) { super(context,prop); assert prop.isCollection(); lister = Lister.create( Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()),prop.id(),prop.getAdapter()); assert lister!=null; acc = prop.getAccessor().optimize(context); assert acc!=null; }
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? }
/** * Gets the {@link TransducedAccessor} appropriately configured for * the given property. * * <p> * This allows the implementation to use an optimized code. */ public static <T> TransducedAccessor<T> get(JAXBContextImpl context, RuntimeNonElementRef ref) { Transducer xducer = RuntimeModelBuilder.createTransducer(ref); RuntimePropertyInfo prop = ref.getSource(); if(prop.isCollection()) { return new ListTransducedAccessorImpl(xducer,prop.getAccessor(), Lister.create(Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()), prop.id(), prop.getAdapter())); } if(prop.id()==ID.IDREF) return new IDREFTransducedAccessorImpl(prop.getAccessor()); if(xducer.useNamespace()) return new CompositeContextDependentTransducedAccessorImpl( context, xducer, prop.getAccessor() ); else return new CompositeTransducedAccessorImpl( context, xducer, prop.getAccessor() ); }
T type = reader.getClassValue(r,"type"); if(nav().isSameType(type, defaultType)) type = nav.erasure(getIndividualType()); if(nav.getBaseClass(type,je)!=null) yield = addGenericElement(r); T type = reader.getClassValue(r,"type"); if (nav().isSameType(type, defaultType)) { type = nav.erasure(getIndividualType());