Module com.sun.xml.bind
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>
Propertyimplementation forAttributePropertyInfo.This one works for both leaves and nodes, scalars and arrays.
Implements
Comparableso that it can be sorted lexicographically.- Author:
- Kohsuke Kawaguchi (kk@kohsuke.org)
-
-
Field Summary
Fields Modifier and Type Field Description NameattNameAttribute name.protected StringfieldNameName of this field.TransducedAccessor<BeanT>xaccHeart 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 voidbuildChildElementUnmarshallers(UnmarshallerChain chainElem, QNameMap<ChildLoader> handlers)Every Property class has an implementation of buildChildElementUnmarshallers which will fill in the specifiedQNameMapby elements that are expected by this property.intcompareTo(AttributeProperty that)AccessorgetElementPropertyAccessor(String nsUri, String localName)If this property is mapped to the specified element, return an accessor to it.StringgetFieldName()StringgetIdValue(BeanT bean)Gets the value of the property.RuntimePropertyInfogetInfo()Provides moreRuntimePropertyInfoinformation on the property.PropertyKindgetKind()Gets the Kind of propertybooleanhasSerializeURIAction()Returns true ifProperty.serializeURIs(Object,XMLSerializer)performs some meaningful action.booleanisHiddenByOverride()voidreset(BeanT o)Resets the property value on the given object.voidserializeAttributes(BeanT o, XMLSerializer w)Marshals one attribute.voidserializeBody(BeanT o, XMLSerializer w, Object outerPeer)voidserializeURIs(BeanT o, XMLSerializer w)voidsetHiddenByOverride(boolean hidden)voidwrapUp()Called at the end of theJAXBContextinitialization 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:
serializeURIsin interfaceProperty<BeanT>- Throws:
AccessorExceptionSAXException- See Also:
JaxBeanInfo.serializeURIs(Object, XMLSerializer)
-
hasSerializeURIAction
public boolean hasSerializeURIAction()
Description copied from interface:PropertyReturns true ifProperty.serializeURIs(Object,XMLSerializer)performs some meaningful action.- Specified by:
hasSerializeURIActionin interfaceProperty<BeanT>
-
buildChildElementUnmarshallers
public void buildChildElementUnmarshallers(UnmarshallerChain chainElem, QNameMap<ChildLoader> handlers)
Description copied from interface:StructureLoaderBuilderEvery Property class has an implementation of buildChildElementUnmarshallers which will fill in the specifiedQNameMapby elements that are expected by this property.- Specified by:
buildChildElementUnmarshallersin interfaceStructureLoaderBuilder
-
getKind
public PropertyKind getKind()
Description copied from interface:PropertyGets the Kind of property
-
reset
public void reset(BeanT o) throws AccessorException
Description copied from interface:PropertyResets the property value on the given object.... for example by setting 0 or null.
- Specified by:
resetin interfaceProperty<BeanT>- Throws:
AccessorException
-
getIdValue
public String getIdValue(BeanT bean) throws AccessorException, SAXException
Description copied from interface:PropertyGets 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:
getIdValuein interfaceProperty<BeanT>- Throws:
AccessorExceptionSAXException
-
compareTo
public int compareTo(AttributeProperty that)
- Specified by:
compareToin interfaceComparable<BeanT>
-
getInfo
public RuntimePropertyInfo getInfo()
Description copied from interface:PropertyProvides moreRuntimePropertyInfoinformation on the property.
-
serializeBody
public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException- Specified by:
serializeBodyin 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 forJaxBeanInfoforJAXBElements.- Throws:
AccessorException- If thrown, caught by the caller and reported.SAXExceptionIOExceptionXMLStreamException- See Also:
JaxBeanInfo.serializeBody(Object, XMLSerializer)
-
getElementPropertyAccessor
public Accessor getElementPropertyAccessor(String nsUri, String localName)
Description copied from interface:PropertyIf this property is mapped to the specified element, return an accessor to it.- Specified by:
getElementPropertyAccessorin interfaceProperty<BeanT>- Returns:
- null if the property is not mapped to the specified element.
-
wrapUp
public void wrapUp()
Description copied from interface:PropertyCalled at the end of theJAXBContextinitialization phase to clean up any unnecessary references.
-
isHiddenByOverride
public boolean isHiddenByOverride()
- Specified by:
isHiddenByOverridein interfaceProperty<BeanT>
-
setHiddenByOverride
public void setHiddenByOverride(boolean hidden)
- Specified by:
setHiddenByOverridein interfaceProperty<BeanT>
-
getFieldName
public String getFieldName()
- Specified by:
getFieldNamein interfaceProperty<BeanT>
-
-