Module com.sun.xml.bind.osgi
Class AttributeProperty<BeanT>
- java.lang.Object
-
- org.glassfish.jaxb.runtime.v2.runtime.property.AttributeProperty<BeanT>
-
- All Implemented Interfaces:
Comparable<AttributeProperty>
,Property<BeanT>
,StructureLoaderBuilder
public final class AttributeProperty<BeanT> extends Object implements Comparable<AttributeProperty>
Property
implementation forAttributePropertyInfo
.This one works for both leaves and nodes, scalars and arrays.
Implements
Comparable
so that it can be sorted lexicographically.- Author:
- Kohsuke Kawaguchi ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description Name
attName
Attribute name.protected String
fieldName
Name of this field.TransducedAccessor<BeanT>
xacc
Heart of the conversion logic.-
Fields inherited from interface org.glassfish.jaxb.runtime.v2.runtime.property.StructureLoaderBuilder
CATCH_ALL, TEXT_HANDLER
-
-
Constructor Summary
Constructors Constructor Description AttributeProperty(JAXBContextImpl context, RuntimeAttributePropertyInfo prop)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildChildElementUnmarshallers(UnmarshallerChain chainElem, QNameMap<ChildLoader> handlers)
Every Property class has an implementation of buildChildElementUnmarshallers which will fill in the specifiedQNameMap
by elements that are expected by this property.int
compareTo(AttributeProperty that)
Accessor
getElementPropertyAccessor(String nsUri, String localName)
If this property is mapped to the specified element, return an accessor to it.String
getFieldName()
String
getIdValue(BeanT bean)
Gets the value of the property.RuntimePropertyInfo
getInfo()
Provides moreRuntimePropertyInfo
information on the property.PropertyKind
getKind()
Gets the Kind of propertyboolean
hasSerializeURIAction()
Returns true ifProperty.serializeURIs(Object,XMLSerializer)
performs some meaningful action.boolean
isHiddenByOverride()
void
reset(BeanT o)
Resets the property value on the given object.void
serializeAttributes(BeanT o, XMLSerializer w)
Marshals one attribute.void
serializeBody(BeanT o, XMLSerializer w, Object outerPeer)
void
serializeURIs(BeanT o, XMLSerializer w)
void
setHiddenByOverride(boolean hidden)
void
wrapUp()
Called at the end of theJAXBContext
initialization phase to clean up any unnecessary references.
-
-
-
Field Detail
-
attName
public final Name attName
Attribute name.
-
xacc
public final TransducedAccessor<BeanT> xacc
Heart of the conversion logic.
-
fieldName
protected final String fieldName
Name of this field.
-
-
Constructor Detail
-
AttributeProperty
public AttributeProperty(JAXBContextImpl context, RuntimeAttributePropertyInfo prop)
-
-
Method Detail
-
serializeAttributes
public void serializeAttributes(BeanT o, XMLSerializer w) throws SAXException, AccessorException, IOException, XMLStreamException
Marshals one attribute.
-
serializeURIs
public void serializeURIs(BeanT o, XMLSerializer w) throws AccessorException, SAXException
- Specified by:
serializeURIs
in interfaceProperty<BeanT>
- Throws:
AccessorException
SAXException
- See Also:
JaxBeanInfo.serializeURIs(Object, XMLSerializer)
-
hasSerializeURIAction
public boolean hasSerializeURIAction()
Description copied from interface:Property
Returns true ifProperty.serializeURIs(Object,XMLSerializer)
performs some meaningful action.- Specified by:
hasSerializeURIAction
in interfaceProperty<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 specifiedQNameMap
by elements that are expected by this property.- Specified by:
buildChildElementUnmarshallers
in interfaceStructureLoaderBuilder
-
getKind
public PropertyKind getKind()
Description copied from interface:Property
Gets the Kind of property
-
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 interfaceProperty<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 correspondingPropertyInfo.id()
isID.ID
, and therefore the return type is fixed toString
.- Specified by:
getIdValue
in interfaceProperty<BeanT>
- Throws:
AccessorException
SAXException
-
compareTo
public int compareTo(AttributeProperty that)
- Specified by:
compareTo
in interfaceComparable<BeanT>
-
getInfo
public RuntimePropertyInfo getInfo()
Description copied from interface:Property
Provides moreRuntimePropertyInfo
information on the property.
-
serializeBody
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException
- Specified by:
serializeBody
in interfaceProperty<BeanT>
outerPeer
- used when this property is expected to print out an element and that should be associated with this outer peer. normally null. this is only used forJaxBeanInfo
forJAXBElement
s.- Throws:
AccessorException
- If thrown, caught by the caller and reported.SAXException
IOException
XMLStreamException
- See Also:
JaxBeanInfo.serializeBody(Object, XMLSerializer)
-
getElementPropertyAccessor
public Accessor getElementPropertyAccessor(String nsUri, String localName)
Description copied from interface:Property
If this property is mapped to the specified element, return an accessor to it.- Specified by:
getElementPropertyAccessor
in interfaceProperty<BeanT>
- Returns:
- null if the property is not mapped to the specified element.
-
wrapUp
public void wrapUp()
Description copied from interface:Property
Called at the end of theJAXBContext
initialization phase to clean up any unnecessary references.
-
isHiddenByOverride
public boolean isHiddenByOverride()
- Specified by:
isHiddenByOverride
in interfaceProperty<BeanT>
-
setHiddenByOverride
public void setHiddenByOverride(boolean hidden)
- Specified by:
setHiddenByOverride
in interfaceProperty<BeanT>
-
getFieldName
public String getFieldName()
- Specified by:
getFieldName
in interfaceProperty<BeanT>
-
-