public class ElementDescriptor extends NodeDescriptor
ElementDescriptor describes the XML elements
to be created for a bean instance.
It contains AttributeDescriptor's for all it's attributes
and ElementDescriptor's for it's child elements.
| Modifier and Type | Field and Description |
|---|---|
private AttributeDescriptor[] |
attributeDescriptors
Descriptors for attributes this element contains.
|
private List |
attributeList
The List used on construction.
|
private Expression |
contextExpression
the expression used to evaluate the new context of this node
or null if the same context is to be used
|
private ElementDescriptor[] |
elementDescriptors
Descriptors for child elements.
|
private List |
elementList
The List used on construction.
|
private boolean |
primitiveType
Whether this element refers to a primitive type (or property of a parent object)
|
private boolean |
wrapCollectionsInElement
Whether this collection element can be used
as a collection element.
|
| Constructor and Description |
|---|
ElementDescriptor()
Constructs an
ElementDescriptor that refers to a primitive type. |
ElementDescriptor(boolean primitiveType)
Base constructor.
|
ElementDescriptor(String localName)
Creates a ElementDescriptor with no namespace URI or prefix.
|
ElementDescriptor(String localName,
String qualifiedName,
String uri)
Creates a
ElementDescriptor with namespace URI and qualified name |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttributeDescriptor(AttributeDescriptor descriptor)
Adds an attribute to the element this
ElementDescriptor describes |
void |
addElementDescriptor(ElementDescriptor descriptor)
Adds a descriptor for a child element.
|
AttributeDescriptor[] |
getAttributeDescriptors()
Returns the attribute descriptors for this element
|
protected List |
getAttributeList()
Lazily creates the mutable List.
|
Expression |
getContextExpression()
Returns the expression used to evaluate the new context of this element.
|
ElementDescriptor[] |
getElementDescriptors()
Returns descriptors for the child elements of the element this describes.
|
protected List |
getElementList()
Lazily creates the mutable List of child elements.
|
boolean |
hasAttributes()
Returns true if this element has
AttributeDescriptors |
boolean |
hasChildren()
Returns true if this element has child
ElementDescriptors |
boolean |
isPrimitiveType()
Returns true if this element refers to a primitive type property
|
boolean |
isWrapCollectionsInElement()
Returns true if collective bean properties should wrap the items in a parent element.
|
void |
setAttributeDescriptors(AttributeDescriptor[] attributeDescriptors)
Sets the
AttributesDescriptors for this element. |
void |
setContextExpression(Expression contextExpression)
Sets the expression used to evaluate the new context of this element
|
void |
setElementDescriptors(ElementDescriptor[] elementDescriptors)
Sets the descriptors for the child element of the element this describes.
|
void |
setPrimitiveType(boolean primitiveType)
Sets whether this element refers to a primitive type (or property of a parent object)
|
void |
setWrapCollectionsInElement(boolean wrapCollectionsInElement)
Sets whether
Collection bean properties should wrap items in a parent element. |
String |
toString()
Returns something useful for logging.
|
getLocalName, getPropertyName, getPropertyType, getQualifiedName, getSingularPropertyType, getTextExpression, getUpdater, getURI, setLocalName, setPropertyName, setPropertyType, setQualifiedName, setSingularPropertyType, setTextExpression, setUpdater, setURIprivate AttributeDescriptor[] attributeDescriptors
private ElementDescriptor[] elementDescriptors
private List attributeList
private List elementList
private Expression contextExpression
private boolean primitiveType
private boolean wrapCollectionsInElement
public ElementDescriptor()
ElementDescriptor that refers to a primitive type.public ElementDescriptor(boolean primitiveType)
primitiveType - if true, this element refers to a primitive typepublic ElementDescriptor(String localName)
localName - the (xml) local name of this node.
This will be used to set both qualified and local name for this name.public ElementDescriptor(String localName, String qualifiedName, String uri)
ElementDescriptor with namespace URI and qualified namelocalName - the (xml) local name of this nodequalifiedName - the (xml) qualified name of this nodeuri - the (xml) namespace prefix of this nodepublic boolean hasChildren()
ElementDescriptorsgetElementDescriptors()public boolean hasAttributes()
AttributeDescriptorsgetAttributeDescriptors()public void setWrapCollectionsInElement(boolean wrapCollectionsInElement)
Collection bean properties should wrap items in a parent element.
In other words, should the mapping for bean properties which are Collections
enclosed the item elements within a parent element.
Normally only used when this describes a collection bean property.wrapCollectionsInElement - true if the elements for the items in the collection
should be contained in a parent elementpublic boolean isWrapCollectionsInElement()
Collections
enclosed the item elements within a parent element.
Normally only used when this describes a collection bean property.public void addAttributeDescriptor(AttributeDescriptor descriptor)
ElementDescriptor describesdescriptor - the AttributeDescriptor that will be added to the
attributes associated with element this ElementDescriptor describespublic AttributeDescriptor[] getAttributeDescriptors()
ElementDescriptor describespublic void setAttributeDescriptors(AttributeDescriptor[] attributeDescriptors)
AttributesDescriptors for this element.
This sets descriptors for the attributes of the element describe by the
ElementDescriptor.attributeDescriptors - the AttributeDescriptor describe the attributes
of the element described by this ElementDescriptorpublic void addElementDescriptor(ElementDescriptor descriptor)
descriptor - the ElementDescriptor describing the child element to addpublic ElementDescriptor[] getElementDescriptors()
ElementDescriptor describing the child elements
of the element that this ElementDescriptor describespublic void setElementDescriptors(ElementDescriptor[] elementDescriptors)
elementDescriptors - the ElementDescriptors of the element
that this describespublic Expression getContextExpression()
public void setContextExpression(Expression contextExpression)
contextExpression - the expression used to evaluate the new context of this elementpublic boolean isPrimitiveType()
public void setPrimitiveType(boolean primitiveType)
primitiveType - true if this element refers to a primitive typeprotected List getAttributeList()
AttributeDescriptors's describing the attributes
of the element that this ElementDescriptor describesprotected List getElementList()
ElementDescriptor's describe the child elements of
the element that this ElementDescriptor describes