com.sun.xml.internal.bind.v2.model.core.Adapter Java Examples
The following examples show how to use
com.sun.xml.internal.bind.v2.model.core.Adapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RuntimeElementInfoImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #2
Source File: Lister.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #3
Source File: XmlSchemaGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #4
Source File: RuntimeElementInfoImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #5
Source File: Lister.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #6
Source File: XmlSchemaGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #7
Source File: RuntimeElementInfoImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #8
Source File: Lister.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #9
Source File: XmlSchemaGenerator.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #10
Source File: RuntimeElementInfoImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #11
Source File: Lister.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #12
Source File: XmlSchemaGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #13
Source File: RuntimeElementInfoImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #14
Source File: Lister.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #15
Source File: XmlSchemaGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #16
Source File: RuntimeElementInfoImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #17
Source File: Lister.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #18
Source File: RuntimeElementInfoImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #19
Source File: XmlSchemaGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #20
Source File: RuntimeElementInfoImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { super(modelBuilder, registry, method); Adapter<Type,Class> a = getProperty().getAdapter(); if(a!=null) adapterType = a.adapterType; else adapterType = null; }
Example #21
Source File: XmlSchemaGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #22
Source File: XmlSchemaGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Examine the specified element ref and determine if a swaRef attribute needs to be generated */ private boolean generateSwaRefAdapter(PropertyInfo<T,C> prop) { final Adapter<T,C> adapter = prop.getAdapter(); if (adapter == null) return false; final Object o = navigator.asDecl(SwaRefAdapter.class); if (o == null) return false; return (o.equals(adapter.adapterType)); }
Example #23
Source File: Lister.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #24
Source File: Lister.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Gets a reference to the appropriate {@link Lister} object * if the field is a multi-value field. Otherwise null. * * @param fieldType * the type of the field that stores the collection * @param idness * ID-ness of the property. * @param adapter * adapter to be used for individual items. can be null. */ public static <BeanT,PropT,ItemT,PackT> Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) { Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); Class itemType; Lister l; if( rawType.isArray() ) { itemType = rawType.getComponentType(); l = getArrayLister(itemType); } else if( Collection.class.isAssignableFrom(rawType) ) { 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; l = new CollectionLister(getImplClass(rawType)); } else return null; if(idness==ID.IDREF) l = new IDREFS(l,itemType); if(adapter!=null) l = new AdaptedLister(l,adapter.adapterType); return l; }
Example #25
Source File: PropertyInfoImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) { this.seed = spi; this.parent = parent; if(parent==null) /* Various people reported a bug where this parameter is somehow null. In an attempt to catch the error better, let's do an explicit check here. http://forums.java.net/jive/thread.jspa?threadID=18479 http://forums.java.net/jive/thread.jspa?messageID=165946 */ throw new AssertionError(); MimeType mt = Util.calcExpectedMediaType(seed,parent.builder); if(mt!=null && !kind().canHaveXmlMimeType) { parent.builder.reportError(new IllegalAnnotationException( Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()), seed.readAnnotation(XmlMimeType.class) )); mt = null; } this.expectedMimeType = mt; this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class); T t = seed.getRawType(); // check if there's an adapter applicable to the whole property XmlJavaTypeAdapter xjta = getApplicableAdapter(t); if(xjta!=null) { isCollection = false; adapter = new Adapter<T,C>(xjta,reader(),nav()); } else { // check if the adapter is applicable to the individual item in the property this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class)) || nav().isArrayButNotByteArray(t); xjta = getApplicableAdapter(getIndividualType()); if(xjta==null) { // ugly ugly hack, but we implement swaRef as adapter XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class); if(xsa!=null) { parent.builder.hasSwaRef = true; adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav()); } else { adapter = null; // if this field has adapter annotation but not applicable, // that must be an error of the user xjta = seed.readAnnotation(XmlJavaTypeAdapter.class); if(xjta!=null) { T ad = reader().getClassValue(xjta,"value"); parent.builder.reportError(new IllegalAnnotationException( Messages.UNMATCHABLE_ADAPTER.format( nav().getTypeName(ad), nav().getTypeName(t)), xjta )); } } } else { adapter = new Adapter<T,C>(xjta,reader(),nav()); } } this.id = calcId(); this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz, getIndividualType(),this); }
Example #26
Source File: ElementInfoImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
public Adapter<T,C> getAdapter() { return adapter; }
Example #27
Source File: PropertyInfoImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) { this.seed = spi; this.parent = parent; if(parent==null) /* Various people reported a bug where this parameter is somehow null. In an attempt to catch the error better, let's do an explicit check here. http://forums.java.net/jive/thread.jspa?threadID=18479 http://forums.java.net/jive/thread.jspa?messageID=165946 */ throw new AssertionError(); MimeType mt = Util.calcExpectedMediaType(seed,parent.builder); if(mt!=null && !kind().canHaveXmlMimeType) { parent.builder.reportError(new IllegalAnnotationException( Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()), seed.readAnnotation(XmlMimeType.class) )); mt = null; } this.expectedMimeType = mt; this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class); T t = seed.getRawType(); // check if there's an adapter applicable to the whole property XmlJavaTypeAdapter xjta = getApplicableAdapter(t); if(xjta!=null) { isCollection = false; adapter = new Adapter<T,C>(xjta,reader(),nav()); } else { // check if the adapter is applicable to the individual item in the property this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class)) || nav().isArrayButNotByteArray(t); xjta = getApplicableAdapter(getIndividualType()); if(xjta==null) { // ugly ugly hack, but we implement swaRef as adapter XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class); if(xsa!=null) { parent.builder.hasSwaRef = true; adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav()); } else { adapter = null; // if this field has adapter annotation but not applicable, // that must be an error of the user xjta = seed.readAnnotation(XmlJavaTypeAdapter.class); if(xjta!=null) { T ad = reader().getClassValue(xjta,"value"); parent.builder.reportError(new IllegalAnnotationException( Messages.UNMATCHABLE_ADAPTER.format( nav().getTypeName(ad), nav().getTypeName(t)), xjta )); } } } else { adapter = new Adapter<T,C>(xjta,reader(),nav()); } } this.id = calcId(); this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz, getIndividualType(),this); }
Example #28
Source File: Accessor.java From hottub with GNU General Public License v2.0 | 4 votes |
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); }
Example #29
Source File: Accessor.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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); }
Example #30
Source File: ElementInfoImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public Adapter<T,C> getAdapter() { return adapter; }