com.sun.xml.bind.v2.model.impl
Class ClassInfoImpl<T,C,F,M>

java.lang.Object
  extended by com.sun.xml.bind.v2.model.impl.TypeInfoImpl<T,C,F,M>
      extended by 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>
Direct Known Subclasses:
RuntimeClassInfoImpl

 class ClassInfoImpl<T,C,F,M>
extends TypeInfoImpl<T,C,F,M>
implements ClassInfo<T,C>, Element<T,C>

A part of the ClassInfo that doesn't depend on a particular reflection library.


Field Summary
protected  PropertySeed<T,C,F,M> attributeWildcard
          If this class has a declared (not inherited) attribute wildcard, keep the reference to it.
protected  C clazz
           
 
Fields inherited from class com.sun.xml.bind.v2.model.impl.TypeInfoImpl
builder, owner
 
Fields inherited from interface com.sun.xml.bind.v2.model.core.NonElement
ANYTYPE_NAME
 
Constructor Summary
ClassInfoImpl(ModelBuilder<T,C,F,M> builder, Locatable upstream, C clazz)
           
 
Method Summary
 Element<T,C> asElement()
          Returns the Element aspect of this ClassInfo.
 boolean canBeReferencedByIDREF()
          A ClassInfo can be referenced by XmlIDREF if it has an ID property.
protected  void checkFieldXmlLocation(F f)
          This hook is used by RuntimeClassInfoImpl to look for XmlLocation.
protected  PropertySeed<T,C,F,M> createAccessorSeed(M getter, M setter)
          Creates a new GetterSetterPropertySeed object.
protected  AttributePropertyInfoImpl<T,C,F,M> createAttributeProperty(PropertySeed<T,C,F,M> seed)
           
protected  ElementPropertyInfoImpl<T,C,F,M> createElementProperty(PropertySeed<T,C,F,M> seed)
           
protected  PropertySeed<T,C,F,M> createFieldSeed(F f)
          Creates a new FieldPropertySeed object.
protected  MapPropertyInfoImpl<T,C,F,M> createMapProperty(PropertySeed<T,C,F,M> seed)
           
protected  ReferencePropertyInfoImpl<T,C,F,M> createReferenceProperty(PropertySeed<T,C,F,M> seed)
           
protected  ValuePropertyInfoImpl<T,C,F,M> createValueProperty(PropertySeed<T,C,F,M> seed)
           
 boolean declaresAttributeWildcard()
          Returns true iff this class declares a wildcard attribute.
 ClassInfoImpl<T,C,F,M> getBaseClass()
          Obtains the information about the base class.
 C getClazz()
          Gets the declaration this object is wrapping.
 QName getElementName()
          Gets the element name of the class, if the class is bound to an element.
 Method getFactoryMethod()
           
 Location getLocation()
          Gets the location object that this object points to.
 String getName()
          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 on ClassInfoImpl.
 Element<T,C> getSubstitutionHead()
          If this element can substitute another element, return that element.
 T getType()
          Gets the underlying Java type that object represents.
 QName getTypeName()
          Gets the primary XML type ANYTYPE_NAME of the class.
 boolean hasAttributeWildcard()
          Returns true if this bean class has an attribute wildcard.
 boolean hasProperties()
          If the class has properties, return true.
 boolean hasSubClasses()
          True if there's a known sub-type of this class in TypeInfoSet.
 boolean hasValueProperty()
          Returns true if this class or its ancestor has XmlValue property.
 boolean inheritsAttributeWildcard()
          Returns true iff this class inherits a wildcard attribute from its ancestor classes.
 boolean isAbstract()
          If this class is abstract and thus shall never be directly instanciated.
 boolean isElement()
          If the class is bound to an element, return true.
 boolean isFinal()
          If this class is marked as final and no further extension/restriction is allowed.
 boolean isOrdered()
          Returns true if the properties of this class is ordered in XML.
 boolean isSimpleType()
          Returns true if this NonElement maps to text in XML, without any attribute nor child elements.
(package private)  void link()
          Called after all the TypeInfos are collected into the TypeInfoImpl.owner.
<A extends Annotation>
A
readAnnotation(Class<A> a)
           
 String toString()
           
 
Methods inherited from class com.sun.xml.bind.v2.model.impl.TypeInfoImpl
getUpstream, nav, parseElementName, parseTypeName, parseTypeName, reader
 
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 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.

Constructor Detail

ClassInfoImpl

ClassInfoImpl(ModelBuilder<T,C,F,M> builder,
              Locatable upstream,
              C clazz)
Method Detail

getBaseClass

public ClassInfoImpl<T,C,F,M> getBaseClass()
Description copied from interface: ClassInfo
Obtains the information about the base class.

Specified by:
getBaseClass in interface ClassInfo<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:
getSubstitutionHead in interface Element<T,C>
Returns:
null if no such element exists.

getClazz

public final C getClazz()
Description copied from interface: ClassInfo
Gets the declaration this object is wrapping.

Specified by:
getClazz in interface ClassInfo<T,C>

getScope

public ClassInfoImpl<T,C,F,M> getScope()
Deprecated. you shouldn't be invoking this method on ClassInfoImpl.

When a bean binds to an element, it's always through XmlRootElement, so this method always return null.

Specified by:
getScope in interface Element<T,C>

getType

public final T getType()
Description copied from interface: TypeInfo
Gets the underlying Java type that object represents.

Specified by:
getType in interface TypeInfo<T,C>
Returns:
always non-null.

canBeReferencedByIDREF

public boolean canBeReferencedByIDREF()
A ClassInfo can be referenced by XmlIDREF if it has an ID property.

Specified by:
canBeReferencedByIDREF in interface TypeInfo<T,C>

getName

public final String getName()
Description copied from interface: ClassInfo
Gets the fully-qualified name of the class.

Specified by:
getName in interface ClassInfo<T,C>

readAnnotation

public <A extends Annotation> A readAnnotation(Class<A> a)

asElement

public Element<T,C> asElement()
Description copied from interface: MaybeElement
Returns the Element aspect of this ClassInfo.

Specified by:
asElement in interface MaybeElement<T,C>
Returns:
null if MaybeElement.isElement()==false, non-null if MaybeElement.isElement()==true.

getProperties

public List<? extends PropertyInfo<T,C>> getProperties()
Description copied from interface: ClassInfo
Returns 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 XmlTransient will not show up in this list. As far as JAXB is concerned, they are considered non-existent.

Specified by:
getProperties in interface ClassInfo<T,C>
Returns:
always non-null, but can be empty.

hasValueProperty

public final boolean hasValueProperty()
Description copied from interface: ClassInfo
Returns true if this class or its ancestor has XmlValue property.

Specified by:
hasValueProperty in interface ClassInfo<T,C>

getProperty

public PropertyInfo<T,C> getProperty(String name)
Description copied from interface: ClassInfo
Gets 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:
getProperty in interface ClassInfo<T,C>
Returns:
null if the property was not found.
See Also:
PropertyInfo.getName()

checkFieldXmlLocation

protected void checkFieldXmlLocation(F f)
This hook is used by RuntimeClassInfoImpl to look for XmlLocation.


hasProperties

public boolean hasProperties()
Description copied from interface: ClassInfo
If the class has properties, return true. This is only true if the Collection object returned by ClassInfo.getProperties() is not empty.

Specified by:
hasProperties in interface ClassInfo<T,C>

createReferenceProperty

protected ReferencePropertyInfoImpl<T,C,F,M> createReferenceProperty(PropertySeed<T,C,F,M> seed)

createAttributeProperty

protected AttributePropertyInfoImpl<T,C,F,M> createAttributeProperty(PropertySeed<T,C,F,M> seed)

createValueProperty

protected ValuePropertyInfoImpl<T,C,F,M> createValueProperty(PropertySeed<T,C,F,M> seed)

createElementProperty

protected ElementPropertyInfoImpl<T,C,F,M> createElementProperty(PropertySeed<T,C,F,M> seed)

createMapProperty

protected MapPropertyInfoImpl<T,C,F,M> createMapProperty(PropertySeed<T,C,F,M> seed)

createFieldSeed

protected PropertySeed<T,C,F,M> createFieldSeed(F f)
Creates a new FieldPropertySeed object.

Derived class can override this method to create a sub-class.


createAccessorSeed

protected PropertySeed<T,C,F,M> createAccessorSeed(M getter,
                                                   M setter)
Creates a new GetterSetterPropertySeed object.


isElement

public final boolean isElement()
Description copied from interface: MaybeElement
If 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:
isElement in interface MaybeElement<T,C>

isAbstract

public boolean isAbstract()
Description copied from interface: ClassInfo
If this class is abstract and thus shall never be directly instanciated.

Specified by:
isAbstract in interface ClassInfo<T,C>

isOrdered

public boolean isOrdered()
Description copied from interface: ClassInfo
Returns 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>.

Specified by:
isOrdered in interface ClassInfo<T,C>

isFinal

public final boolean isFinal()
Description copied from interface: ClassInfo
If this class is marked as final and no further extension/restriction is allowed.

Specified by:
isFinal in interface ClassInfo<T,C>

hasSubClasses

public final boolean hasSubClasses()
Description copied from interface: ClassInfo
True if there's a known sub-type of this class in TypeInfoSet.

Specified by:
hasSubClasses in interface ClassInfo<T,C>

hasAttributeWildcard

public final boolean hasAttributeWildcard()
Description copied from interface: ClassInfo
Returns 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:
hasAttributeWildcard in interface ClassInfo<T,C>
See Also:
ClassInfo.inheritsAttributeWildcard()

inheritsAttributeWildcard

public final boolean inheritsAttributeWildcard()
Description copied from interface: ClassInfo
Returns true iff this class inherits a wildcard attribute from its ancestor classes.

Specified by:
inheritsAttributeWildcard in interface ClassInfo<T,C>

declaresAttributeWildcard

public final boolean declaresAttributeWildcard()
Description copied from interface: ClassInfo
Returns true iff this class declares a wildcard attribute.

Specified by:
declaresAttributeWildcard in interface ClassInfo<T,C>

getElementName

public final QName getElementName()
Description copied from interface: MaybeElement
Gets the element name of the class, if the class is bound to an element.

Specified by:
getElementName in interface Element<T,C>
Specified by:
getElementName in interface MaybeElement<T,C>
Returns:
non-null iff MaybeElement.isElement().

getTypeName

public final QName getTypeName()
Description copied from interface: NonElement
Gets 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:
getTypeName in interface NonElement<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: NonElement
Returns true if this NonElement maps to text in XML, without any attribute nor child elements.

Specified by:
isSimpleType in interface NonElement<T,C>

link

void link()
Called after all the TypeInfos are collected into the TypeInfoImpl.owner.

Overrides:
link in class TypeInfoImpl<T,C,F,M>

getLocation

public Location getLocation()
Description copied from interface: Locatable
Gets the location object that this object points to. This operation could be inefficient and costly.

Specified by:
getLocation in interface Locatable

getFactoryMethod

public Method getFactoryMethod()

toString

public String toString()
Overrides:
toString in class Object