/** * Builds a JAXB {@link ClassInfo} model from a given class declaration * and adds that to this model owner. * * <p> * Return type is either {@link ClassInfo} or {@link LeafInfo} (for types like * {@link String} or {@link Enum}-derived ones) */ public NonElement<T,C> getClassInfo( C clazz, Locatable upstream ) { return getClassInfo(clazz,false,upstream); }
@Override public RuntimeNonElement getClassInfo( Class clazz, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,upstream); }
@Override public RuntimeNonElement getClassInfo( Class clazz, boolean searchForSuperClass, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,searchForSuperClass,upstream); }
public ClassInfoImpl<T,C,F,M> getBaseClass() { if (!baseClassComputed) { // compute the base class C s = nav().getSuperClass(clazz); if(s==null || s==nav().asDecl(Object.class)) { baseClass = null; } else { NonElement<T,C> b = builder.getClassInfo(s, true, this); if(b instanceof ClassInfoImpl) { baseClass = (ClassInfoImpl<T,C,F,M>) b; baseClass.hasSubClasses = true; } else { baseClass = null; } } baseClassComputed = true; } return baseClass; }
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
private boolean addAllSubtypes(T type) { Navigator<T,C,F,M> nav = nav(); // this allows the explicitly referenced type to be sucked in to the model NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this); if(!(t instanceof ClassInfo)) // this is leaf. return false; boolean result = false; ClassInfo<T,C> c = (ClassInfo<T,C>) t; if(c.isElement()) { types.add(c.asElement()); result = true; } // look for other possible types for( ClassInfo<T,C> ci : parent.owner.beans().values() ) { if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) { types.add(ci.asElement()); result = true; } } // don't allow local elements to substitute. for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) { if(nav.isSubClassOf(ei.getType(),type)) { types.add(ei); result = true; } } return result; }
/** * Builds a JAXB {@link ClassInfo} model from a given class declaration * and adds that to this model owner. * * <p> * Return type is either {@link ClassInfo} or {@link LeafInfo} (for types like * {@link String} or {@link Enum}-derived ones) */ public NonElement<T,C> getClassInfo( C clazz, Locatable upstream ) { return getClassInfo(clazz,false,upstream); }
@Override public RuntimeNonElement getClassInfo( Class clazz, boolean searchForSuperClass, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,searchForSuperClass,upstream); }
@Override public RuntimeNonElement getClassInfo( Class clazz, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,upstream); }
if(isReplaced && !searchForSuperClass) { r = getClassInfo(subclassReplacements.get(clazz),upstream); } else if(reader.hasClassAnnotation(clazz,XmlTransient.class) || isReplaced) { r = getClassInfo( nav.getSuperClass(clazz), searchForSuperClass, new ClassLocatable<C>(upstream,clazz,nav) ); } else {
public ClassInfoImpl<T,C,F,M> getBaseClass() { if (!baseClassComputed) { // compute the base class C s = nav().getSuperClass(clazz); if(s==null || s==nav().asDecl(Object.class)) { baseClass = null; } else { NonElement<T,C> b = builder.getClassInfo(s, true, this); if(b instanceof ClassInfoImpl) { baseClass = (ClassInfoImpl<T,C,F,M>) b; baseClass.hasSubClasses = true; } else { baseClass = null; } } baseClassComputed = true; } return baseClass; }
/** * Have the builder recognize the type (if it hasn't done so yet), * and returns a {@link NonElement} that represents it. * * @return * always non-null. */ public NonElement<T,C> getTypeInfo(T t,Locatable upstream) { NonElement<T,C> r = typeInfoSet.getTypeInfo(t); if(r!=null) return r; if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null ArrayInfoImpl<T,C,F,M> ai = createArrayInfo(upstream, t); addTypeName(ai); typeInfoSet.add(ai); return ai; } C c = nav.asDecl(t); assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; return getClassInfo(c,upstream); }
private boolean addAllSubtypes(T type) { Navigator<T,C,F,M> nav = nav(); // this allows the explicitly referenced type to be sucked in to the model NonElement<T,C> t = parent.builder.getClassInfo(nav.asDecl(type),this); if(!(t instanceof ClassInfo)) // this is leaf. return false; boolean result = false; ClassInfo<T,C> c = (ClassInfo<T,C>) t; if(c.isElement()) { types.add(c.asElement()); result = true; } // look for other possible types for( ClassInfo<T,C> ci : parent.owner.beans().values() ) { if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) { types.add(ci.asElement()); result = true; } } // don't allow local elements to substitute. for( ElementInfo<T,C> ei : parent.owner.getElementMappings(null).values()) { if(nav.isSubClassOf(ei.getType(),type)) { types.add(ei); result = true; } } return result; }
else { NonElement<T,C> scp = builder.getClassInfo(nav().asDecl(s),this); if(!(scp instanceof ClassInfo)) { throw new IllegalAnnotationException(
@Override public RuntimeNonElement getClassInfo( Class clazz, boolean searchForSuperClass, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,searchForSuperClass,upstream); }
/** * Builds a JAXB {@link ClassInfo} model from a given class declaration * and adds that to this model owner. * * <p> * Return type is either {@link ClassInfo} or {@link LeafInfo} (for types like * {@link String} or {@link Enum}-derived ones) */ public NonElement<T,C> getClassInfo( C clazz, Locatable upstream ) { return getClassInfo(clazz,false,upstream); }
@Override public RuntimeNonElement getClassInfo( Class clazz, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,upstream); }
@Override public RuntimeNonElement getClassInfo( Class clazz, boolean searchForSuperClass, Locatable upstream ) { return (RuntimeNonElement)super.getClassInfo(clazz,searchForSuperClass,upstream); }
if(isReplaced && !searchForSuperClass) { r = getClassInfo(subclassReplacements.get(clazz),upstream); } else if(reader.hasClassAnnotation(clazz,XmlTransient.class) || isReplaced) { r = getClassInfo( nav.getSuperClass(clazz), searchForSuperClass, new ClassLocatable<C>(upstream,clazz,nav) ); } else {
else { NonElement<T,C> scp = builder.getClassInfo(nav().asDecl(s),this); if(!(scp instanceof ClassInfo)) { throw new IllegalAnnotationException(