com.sun.xml.bind.v2.runtime.property
Class AttributeProperty<BeanT>

java.lang.Object
  extended by com.sun.xml.bind.v2.runtime.property.PropertyImpl<BeanT>
      extended by com.sun.xml.bind.v2.runtime.property.AttributeProperty<BeanT>
All Implemented Interfaces:
Property<BeanT>, StructureLoaderBuilder, Comparable<AttributeProperty>

public final class AttributeProperty<BeanT>
extends PropertyImpl<BeanT>
implements Comparable<AttributeProperty>

Property implementation for AttributePropertyInfo.

This one works for both leaves and nodes, scalars and arrays.

Implements Comparable so that it can be sorted lexicographically.


Field Summary
 Name attName
          Attribute name.
 TransducedAccessor<BeanT> xacc
          Heart of the conversion logic.
 
Fields inherited from class com.sun.xml.bind.v2.runtime.property.PropertyImpl
fieldName
 
Fields inherited from interface com.sun.xml.bind.v2.runtime.property.StructureLoaderBuilder
CATCH_ALL, TEXT_HANDLER
 
Constructor Summary
AttributeProperty(JAXBContextImpl context, RuntimeAttributePropertyInfo prop)
           
 
Method Summary
 void buildChildElementUnmarshallers(UnmarshallerChain chainElem, QNameMap<ChildLoader> handlers)
          Every Property class has an implementation of buildChildElementUnmarshallers which will fill in the specified QNameMap by elements that are expected by this property.
 int compareTo(AttributeProperty that)
           
 String getIdValue(BeanT bean)
          Gets the value of the property.
 PropertyKind getKind()
          Gets the Kind of property
 boolean hasSerializeURIAction()
          Returns true if Property.serializeURIs(Object,XMLSerializer) performs some meaningful action.
 void reset(BeanT o)
          Resets the property value on the given object.
 void serializeAttributes(BeanT o, XMLSerializer w)
          Marshals one attribute.
 void serializeURIs(BeanT o, XMLSerializer w)
           
 
Methods inherited from class com.sun.xml.bind.v2.runtime.property.PropertyImpl
getElementPropertyAccessor, serializeBody, wrapUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attName

public final Name attName
Attribute name.


xacc

public final TransducedAccessor<BeanT> xacc
Heart of the conversion logic.

Constructor Detail

AttributeProperty

public AttributeProperty(JAXBContextImpl context,
                         RuntimeAttributePropertyInfo prop)
Method Detail

serializeAttributes

public void serializeAttributes(BeanT o,
                                XMLSerializer w)
                         throws SAXException,
                                AccessorException,
                                IOException,
                                javax.xml.stream.XMLStreamException
Marshals one attribute.

Throws:
SAXException
AccessorException
IOException
javax.xml.stream.XMLStreamException
See Also:
JaxBeanInfo.serializeAttributes(Object, XMLSerializer)

serializeURIs

public void serializeURIs(BeanT o,
                          XMLSerializer w)
                   throws AccessorException,
                          SAXException
Specified by:
serializeURIs in interface Property<BeanT>
Overrides:
serializeURIs in class PropertyImpl<BeanT>
Throws:
AccessorException
SAXException
See Also:
JaxBeanInfo.serializeURIs(Object, XMLSerializer)

hasSerializeURIAction

public boolean hasSerializeURIAction()
Description copied from interface: Property
Returns true if Property.serializeURIs(Object,XMLSerializer) performs some meaningful action.

Specified by:
hasSerializeURIAction in interface Property<BeanT>
Overrides:
hasSerializeURIAction in class PropertyImpl<BeanT>

buildChildElementUnmarshallers

public void buildChildElementUnmarshallers(UnmarshallerChain chainElem,
                                           QNameMap<ChildLoader> handlers)
Description copied from interface: StructureLoaderBuilder
Every Property class has an implementation of buildChildElementUnmarshallers which will fill in the specified QNameMap by elements that are expected by this property.

Specified by:
buildChildElementUnmarshallers in interface StructureLoaderBuilder

getKind

public PropertyKind getKind()
Description copied from interface: Property
Gets the Kind of property

Specified by:
getKind in interface Property<BeanT>
Returns:
always non-null.

reset

public void reset(BeanT o)
           throws AccessorException
Description copied from interface: Property
Resets the property value on the given object.

... for example by setting 0 or null.

Specified by:
reset in interface Property<BeanT>
Throws:
AccessorException

getIdValue

public String getIdValue(BeanT bean)
                  throws AccessorException,
                         SAXException
Description copied from interface: Property
Gets the value of the property. This method is only used when the corresponding PropertyInfo.id() is ID.ID, and therefore the return type is fixed to String.

Specified by:
getIdValue in interface Property<BeanT>
Throws:
AccessorException
SAXException

compareTo

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