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

java.lang.Object
  extended by com.sun.xml.bind.v2.model.impl.PropertyInfoImpl<T,C,F,M>
All Implemented Interfaces:
AnnotationSource, Locatable, PropertyInfo<T,C>, Comparable<PropertyInfoImpl>
Direct Known Subclasses:
ERPropertyInfoImpl, MapPropertyInfoImpl, SingleTypePropertyInfoImpl

abstract class PropertyInfoImpl<T,C,F,M>
extends Object
implements PropertyInfo<T,C>, Locatable, Comparable<PropertyInfoImpl>

Default partial implementation for PropertyInfo.


Field Summary
protected  ClassInfoImpl<T,C,F,M> parent
           
protected  PropertySeed<T,C,F,M> seed
          Object that reads annotations.
 
Constructor Summary
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi)
           
 
Method Summary
protected  QName calcXmlName(XmlElement e)
          Computes the tag name from a XmlElement by taking the defaulting into account.
protected  QName calcXmlName(XmlElementWrapper e)
          Computes the tag name from a XmlElementWrapper by taking the defaulting into account.
 int compareTo(PropertyInfoImpl that)
           
 String displayName()
          Gets the display name of the property.
 Adapter<T,C> getAdapter()
          This is the default implementation of the getAdapter method defined on many of the PropertyInfo-derived classes.
 javax.activation.MimeType getExpectedMimeType()
          Expected MIME type, if any.
 T getIndividualType()
           
 Location getLocation()
          Gets the location object that this object points to.
 String getName()
          Gets the name of the property.
 T getRawType()
           
 QName getSchemaType()
          The effective value of XmlSchemaType annotation, if any.
 Locatable getUpstream()
          A PropertyInfoImpl is always referenced by its enclosing class, so return that as the upstream.
 boolean hasAnnotation(Class<? extends Annotation> annotationType)
          Returns true if the property has the specified annotation.
 ID id()
          Returns the IDness of the value of this element.
 boolean inlineBinaryData()
          If this is true and this property indeed represents a binary data, it should be always inlined.
 boolean isCollection()
          Returns true if this is a multi-valued collection property.
protected  void link()
          Called after all the TypeInfos are collected into the governing TypeInfoSet.
protected  Navigator<T,C,F,M> nav()
           
 ClassInfoImpl<T,C,F,M> parent()
          Gets the ClassInfo or ElementInfo to which this property belongs.
<A extends Annotation>
A
readAnnotation(Class<A> annotationType)
          Gets the value of the specified annotation from the given property.
protected  AnnotationReader<T,C,F,M> reader()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.PropertyInfo
kind, ref
 

Field Detail

seed

protected final PropertySeed<T,C,F,M> seed
Object that reads annotations.


parent

protected final ClassInfoImpl<T,C,F,M> parent
Constructor Detail

PropertyInfoImpl

protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent,
                           PropertySeed<T,C,F,M> spi)
Method Detail

parent

public ClassInfoImpl<T,C,F,M> parent()
Description copied from interface: PropertyInfo
Gets the ClassInfo or ElementInfo to which this property belongs.

Specified by:
parent in interface PropertyInfo<T,C>

nav

protected final Navigator<T,C,F,M> nav()

reader

protected final AnnotationReader<T,C,F,M> reader()

getRawType

public T getRawType()

getIndividualType

public T getIndividualType()

getName

public final String getName()
Description copied from interface: PropertyInfo
Gets the name of the property.

For example, "foo" or "bar". Generally, a property name is different from XML, (although they are often related, as a property name is often computed from tag names / attribute names.) In fact, property names do not directly affect XML. The property name uniquely identifies a property within a class.

Specified by:
getName in interface PropertyInfo<T,C>
See Also:
XmlType.propOrder()

getAdapter

public Adapter<T,C> getAdapter()
This is the default implementation of the getAdapter method defined on many of the PropertyInfo-derived classes.

Specified by:
getAdapter in interface PropertyInfo<T,C>
Returns:
null if the property is not adapted.

displayName

public final String displayName()
Description copied from interface: PropertyInfo
Gets the display name of the property.

This is a convenience method for parent().getName()+'#'+getName().

Specified by:
displayName in interface PropertyInfo<T,C>

id

public final ID id()
Description copied from interface: PropertyInfo
Returns the IDness of the value of this element.

Specified by:
id in interface PropertyInfo<T,C>
Returns:
always non-null
See Also:
XmlID, XmlIDREF

getExpectedMimeType

public final javax.activation.MimeType getExpectedMimeType()
Description copied from interface: PropertyInfo
Expected MIME type, if any.

Specified by:
getExpectedMimeType in interface PropertyInfo<T,C>

inlineBinaryData

public final boolean inlineBinaryData()
Description copied from interface: PropertyInfo
If this is true and this property indeed represents a binary data, it should be always inlined.

Specified by:
inlineBinaryData in interface PropertyInfo<T,C>

getSchemaType

public final QName getSchemaType()
Description copied from interface: PropertyInfo
The effective value of XmlSchemaType annotation, if any.

If the property doesn't have XmlSchemaType annotation, this method returns null.

Since a type name is a property of a Java type, not a Java property, A schema type name of a Java type should be primarily obtained by using NonElement.getTypeName(). This method is to correctly implement the ugly semantics of XmlSchemaType (namely when this returns non-null, it overrides the type names of all types that are in this property.)

Specified by:
getSchemaType in interface PropertyInfo<T,C>

isCollection

public final boolean isCollection()
Description copied from interface: PropertyInfo
Returns true if this is a multi-valued collection property. Otherwise false, in which case the property is a single value.

Specified by:
isCollection in interface PropertyInfo<T,C>

link

protected void link()
Called after all the TypeInfos are collected into the governing TypeInfoSet. Derived class can do additional actions to complete the model.


getUpstream

public Locatable getUpstream()
A PropertyInfoImpl is always referenced by its enclosing class, so return that as the upstream.

Specified by:
getUpstream in interface Locatable
Returns:
can be null.

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

calcXmlName

protected final QName calcXmlName(XmlElement e)
Computes the tag name from a XmlElement by taking the defaulting into account.


calcXmlName

protected final QName calcXmlName(XmlElementWrapper e)
Computes the tag name from a XmlElementWrapper by taking the defaulting into account.


compareTo

public int compareTo(PropertyInfoImpl that)
Specified by:
compareTo in interface Comparable<PropertyInfoImpl>

readAnnotation

public final <A extends Annotation> A readAnnotation(Class<A> annotationType)
Description copied from interface: AnnotationSource
Gets the value of the specified annotation from the given property.

When this method is used for a property that consists of a getter and setter, it returns the annotation on either of those methods. If both methods have the same annotation, it is an error.

Specified by:
readAnnotation in interface AnnotationSource
Returns:
null if the annotation is not present.

hasAnnotation

public final boolean hasAnnotation(Class<? extends Annotation> annotationType)
Description copied from interface: AnnotationSource
Returns true if the property has the specified annotation.

Short for readAnnotation(annotationType)!=null, but this method is typically faster.

Specified by:
hasAnnotation in interface AnnotationSource