Class ClassInfoImpl<T,C,F,M>
- java.lang.Object
-
- com.sun.xml.bind.v2.model.impl.ClassInfoImpl<T,C,F,M>
-
- All Implemented Interfaces:
Locatable,ClassInfo<T,C>,Element<T,C>,MaybeElement<T,C>,NonElement<T,C>,TypeInfo<T,C>
public class ClassInfoImpl<T,C,F,M> extends Object implements ClassInfo<T,C>, Element<T,C>
A part of theClassInfothat doesn't depend on a particular reflection library.- Author:
- Kohsuke Kawaguchi (kk@kohsuke.org)
-
-
Field Summary
Fields Modifier and Type Field Description protected com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M>attributeWildcardIf this class has a declared (not inherited) attribute wildcard, keep the reference to it.protected ModelBuilder<TypeT,ClassDeclT,FieldT,MethodT>builderReference to theModelBuilder, only until we linkTypeInfos all together, because we don't want to keepModelBuildertoo long.protected Cclazzprotected com.sun.xml.bind.v2.model.impl.TypeInfoSetImpl<TypeT,ClassDeclT,FieldT,MethodT>ownerTypeInfoSetto which this class belongs.-
Fields inherited from interface com.sun.xml.bind.v2.model.core.NonElement
ANYTYPE_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Element<T,C>asElement()booleancanBeReferencedByIDREF()protected voidcheckFieldXmlLocation(F f)This hook is used byRuntimeClassInfoImplto look forXmlLocation.protected com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M>createAccessorSeed(M getter, M setter)Creates a newGetterSetterPropertySeedobject.protected com.sun.xml.bind.v2.model.impl.AttributePropertyInfoImpl<T,C,F,M>createAttributeProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)protected com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl<T,C,F,M>createElementProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)protected com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M>createFieldSeed(F f)Creates a newFieldPropertySeedobject.protected com.sun.xml.bind.v2.model.impl.MapPropertyInfoImpl<T,C,F,M>createMapProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)protected com.sun.xml.bind.v2.model.impl.ReferencePropertyInfoImpl<T,C,F,M>createReferenceProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)protected com.sun.xml.bind.v2.model.impl.ValuePropertyInfoImpl<T,C,F,M>createValueProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)booleandeclaresAttributeWildcard()Returns true iff this class declares a wildcard attribute.ClassInfoImpl<T,C,F,M>getBaseClass()Obtains the information about the base class.CgetClazz()Gets the declaration this object is wrapping.QNamegetElementName()Gets the element name of the class, if the class is bound to an element.MethodgetFactoryMethod()LocationgetLocation()Gets the location object that this object points to.StringgetName()Gets the fully-qualified name of the class.List<? extends PropertyInfo<T,C>>getProperties()Returns all the properties newly declared in this class.PropertyInfo<T,C>getProperty(String name)Gets the property that has the specified name.ClassInfoImpl<T,C,F,M>getScope()Deprecated.you shouldn't be invoking this method onClassInfoImpl.Element<T,C>getSubstitutionHead()If this element can substitute another element, return that element.TgetType()Gets the underlying Java type that object represents.QNamegetTypeName()Gets the primary XML type ANYTYPE_NAME of the class.LocatablegetUpstream()Gets the upstreamLocationinformation.booleanhasAttributeWildcard()Returns true if this bean class has an attribute wildcard.booleanhasProperties()If the class has properties, return true.booleanhasSubClasses()True if there's a known sub-type of this class inTypeInfoSet.booleanhasValueProperty()Returns true if this class or its ancestor hasXmlValueproperty.booleaninheritsAttributeWildcard()Returns true iff this class inherits a wildcard attribute from its ancestor classes.booleanisAbstract()If this class is abstract and thus shall never be directly instanciated.booleanisElement()If the class is bound to an element, return true.booleanisFinal()If this class is marked as final and no further extension/restriction is allowed.booleanisOrdered()Returns true if the properties of this class is ordered in XML.booleanisSimpleType()Returns true if thisNonElementmaps to text in XML, without any attribute nor child elements.protected Navigator<TypeT,ClassDeclT,FieldT,MethodT>nav()protected QNameparseElementName(ClassDeclT clazz)Parses anXmlRootElementannotation on a class and determine the element name.protected QNameparseTypeName(ClassDeclT clazz)protected QNameparseTypeName(ClassDeclT clazz, XmlType t)Parses a (potentially-null)XmlTypeannotation on a class and determine the actual value.<A extends Annotation>
AreadAnnotation(Class<A> a)protected AnnotationReader<TypeT,ClassDeclT,FieldT,MethodT>reader()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.sun.xml.bind.v2.model.annotation.Locatable
getUpstream
-
-
-
-
Field Detail
-
clazz
protected final C clazz
-
attributeWildcard
protected com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> attributeWildcard
If this class has a declared (not inherited) attribute wildcard, keep the reference to it. This parameter is initialized at the construction time and never change.
-
owner
protected final com.sun.xml.bind.v2.model.impl.TypeInfoSetImpl<TypeT,ClassDeclT,FieldT,MethodT> owner
TypeInfoSetto which this class belongs.
-
builder
protected ModelBuilder<TypeT,ClassDeclT,FieldT,MethodT> builder
Reference to theModelBuilder, only until we linkTypeInfos all together, because we don't want to keepModelBuildertoo long.
-
-
Method Detail
-
getBaseClass
public ClassInfoImpl<T,C,F,M> getBaseClass()
Description copied from interface:ClassInfoObtains the information about the base class.- Specified by:
getBaseClassin interfaceClassInfo<T,C>- Returns:
- null
if this info extends from
Object.
-
getSubstitutionHead
public final Element<T,C> getSubstitutionHead()
If this element can substitute another element, return that element.Substitutability of elements are transitive. The substitution hierarchy is the same as the inheritance hierarchy.
- Specified by:
getSubstitutionHeadin interfaceElement<T,C>- Returns:
- null if no such element exists.
-
getClazz
public final C getClazz()
Description copied from interface:ClassInfoGets the declaration this object is wrapping.
-
getScope
public ClassInfoImpl<T,C,F,M> getScope()
Deprecated.you shouldn't be invoking this method onClassInfoImpl.When a bean binds to an element, it's always throughXmlRootElement, so this method always return null.
-
getType
public final T getType()
Description copied from interface:TypeInfoGets the underlying Java type that object represents.
-
canBeReferencedByIDREF
public boolean canBeReferencedByIDREF()
- Specified by:
canBeReferencedByIDREFin interfaceTypeInfo<T,C>
-
getName
public final String getName()
Description copied from interface:ClassInfoGets the fully-qualified name of the class.
-
readAnnotation
public <A extends Annotation> A readAnnotation(Class<A> a)
-
asElement
public Element<T,C> asElement()
Description copied from interface:MaybeElement- Specified by:
asElementin interfaceMaybeElement<T,C>- Returns:
- null if
MaybeElement.isElement()==false, non-null ifMaybeElement.isElement()==true.
-
getProperties
public List<? extends PropertyInfo<T,C>> getProperties()
Description copied from interface:ClassInfoReturns all the properties newly declared in this class.This excludes properties defined in the super class.
If the properties are
ordered, it will be returned in the order that appear in XML. Otherwise it will be returned in no particular order.Properties marked with
XmlTransientwill not show up in this list. As far as JAXB is concerned, they are considered non-existent.- Specified by:
getPropertiesin interfaceClassInfo<T,C>- Returns:
- always non-null, but can be empty.
-
hasValueProperty
public final boolean hasValueProperty()
Description copied from interface:ClassInfoReturns true if this class or its ancestor hasXmlValueproperty.- Specified by:
hasValuePropertyin interfaceClassInfo<T,C>
-
getProperty
public PropertyInfo<T,C> getProperty(String name)
Description copied from interface:ClassInfoGets the property that has the specified name.This is just a convenience method for:
for( PropertyInfo p : getProperties() ) { if(p.getName().equals(name)) return p; } return null;- Specified by:
getPropertyin interfaceClassInfo<T,C>- Returns:
- null if the property was not found.
- See Also:
PropertyInfo.getName()
-
checkFieldXmlLocation
protected void checkFieldXmlLocation(F f)
This hook is used byRuntimeClassInfoImplto look forXmlLocation.
-
hasProperties
public boolean hasProperties()
Description copied from interface:ClassInfoIf the class has properties, return true. This is only true if the Collection object returned byClassInfo.getProperties()is not empty.- Specified by:
hasPropertiesin interfaceClassInfo<T,C>
-
createReferenceProperty
protected com.sun.xml.bind.v2.model.impl.ReferencePropertyInfoImpl<T,C,F,M> createReferenceProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)
-
createAttributeProperty
protected com.sun.xml.bind.v2.model.impl.AttributePropertyInfoImpl<T,C,F,M> createAttributeProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)
-
createValueProperty
protected com.sun.xml.bind.v2.model.impl.ValuePropertyInfoImpl<T,C,F,M> createValueProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)
-
createElementProperty
protected com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl<T,C,F,M> createElementProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)
-
createMapProperty
protected com.sun.xml.bind.v2.model.impl.MapPropertyInfoImpl<T,C,F,M> createMapProperty(com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> seed)
-
createFieldSeed
protected com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> createFieldSeed(F f)
Creates a newFieldPropertySeedobject.Derived class can override this method to create a sub-class.
-
createAccessorSeed
protected com.sun.xml.bind.v2.model.impl.PropertySeed<T,C,F,M> createAccessorSeed(M getter, M setter)
Creates a newGetterSetterPropertySeedobject.
-
isElement
public final boolean isElement()
Description copied from interface:MaybeElementIf the class is bound to an element, return true.Note that when this is true, the class is bound to both an element and a type.
- Specified by:
isElementin interfaceMaybeElement<T,C>
-
isAbstract
public boolean isAbstract()
Description copied from interface:ClassInfoIf this class is abstract and thus shall never be directly instanciated.- Specified by:
isAbstractin interfaceClassInfo<T,C>
-
isOrdered
public boolean isOrdered()
Description copied from interface:ClassInfoReturns true if the properties of this class is ordered in XML. False if it't not.In RELAX NG context, ordered properties mean
<group>and unordered properties mean<interleave>.
-
isFinal
public final boolean isFinal()
Description copied from interface:ClassInfoIf this class is marked as final and no further extension/restriction is allowed.
-
hasSubClasses
public final boolean hasSubClasses()
Description copied from interface:ClassInfoTrue if there's a known sub-type of this class inTypeInfoSet.- Specified by:
hasSubClassesin interfaceClassInfo<T,C>
-
hasAttributeWildcard
public final boolean hasAttributeWildcard()
Description copied from interface:ClassInfoReturns true if this bean class has an attribute wildcard.This is true if the class declares an attribute wildcard, or it is inherited from its super classes.
- Specified by:
hasAttributeWildcardin interfaceClassInfo<T,C>- See Also:
ClassInfo.inheritsAttributeWildcard()
-
inheritsAttributeWildcard
public final boolean inheritsAttributeWildcard()
Description copied from interface:ClassInfoReturns true iff this class inherits a wildcard attribute from its ancestor classes.- Specified by:
inheritsAttributeWildcardin interfaceClassInfo<T,C>
-
declaresAttributeWildcard
public final boolean declaresAttributeWildcard()
Description copied from interface:ClassInfoReturns true iff this class declares a wildcard attribute.- Specified by:
declaresAttributeWildcardin interfaceClassInfo<T,C>
-
getElementName
public final QName getElementName()
Description copied from interface:MaybeElementGets the element name of the class, if the class is bound to an element.- Specified by:
getElementNamein interfaceElement<T,C>- Specified by:
getElementNamein interfaceMaybeElement<T,C>- Returns:
- non-null iff
MaybeElement.isElement().
-
getTypeName
public final QName getTypeName()
Description copied from interface:NonElementGets the primary XML type ANYTYPE_NAME of the class.A Java type can be mapped to multiple XML types, but one of them is considered "primary" and used when we generate a schema.
- Specified by:
getTypeNamein interfaceNonElement<T,C>- Returns:
- null if the object doesn't have an explicit type ANYTYPE_NAME (AKA anonymous.)
-
isSimpleType
public final boolean isSimpleType()
Description copied from interface:NonElementReturns true if thisNonElementmaps to text in XML, without any attribute nor child elements.- Specified by:
isSimpleTypein interfaceNonElement<T,C>
-
getLocation
public Location getLocation()
Description copied from interface:LocatableGets the location object that this object points to. This operation could be inefficient and costly.- Specified by:
getLocationin interfaceLocatable
-
getFactoryMethod
public Method getFactoryMethod()
-
getUpstream
public Locatable getUpstream()
Description copied from interface:LocatableGets the upstreamLocationinformation.- Specified by:
getUpstreamin interfaceLocatable- Returns:
- can be null.
-
nav
protected final Navigator<TypeT,ClassDeclT,FieldT,MethodT> nav()
-
reader
protected final AnnotationReader<TypeT,ClassDeclT,FieldT,MethodT> reader()
-
parseElementName
protected final QName parseElementName(ClassDeclT clazz)
Parses anXmlRootElementannotation on a class and determine the element name.- Returns:
- null if none was found.
-
parseTypeName
protected final QName parseTypeName(ClassDeclT clazz)
-
parseTypeName
protected final QName parseTypeName(ClassDeclT clazz, XmlType t)
Parses a (potentially-null)XmlTypeannotation on a class and determine the actual value.- Parameters:
clazz- The class on which the XmlType annotation is checked.t- TheXmlTypeannotation on the clazz. This value is taken as a parameter to improve the performance for the case where 't' is pre-computed.
-
-