public abstract class ForwardingElementMetadata<D,E extends Element> extends java.lang.Object implements ElementMetadata<D,E>
ElementMetadata.Cardinality, ElementMetadata.MultipleVirtualElement, ElementMetadata.SingleVirtualElement
Metadata.VirtualValue
Constructor and Description |
---|
ForwardingElementMetadata() |
Modifier and Type | Method and Description |
---|---|
ElementKey<?,?> |
adapt(java.lang.String kind)
Adapts this metadata to another type, based on the given kind.
|
ElementMetadata<D,E> |
bind(MetadataContext context)
Binds this element metadata to the given context.
|
<K> AttributeMetadata<K> |
bindAttribute(AttributeKey<K> key)
Binds the attribute metadata associated with a particular key.
|
<K,L extends Element> |
bindElement(ElementKey<K,L> key)
Binds the child element metadata associated with a particular key.
|
E |
createElement()
Create an element with this metadata as the metadata for the element.
|
protected abstract ElementMetadata<D,E> |
delegate()
Returns the delegate element metadata instance that is the delegation
target for this forwarding instance.
|
AttributeKey<?> |
findAttribute(QName id)
Finds an attribute of the given id on this element or any adaptations.
|
ElementKey<?,?> |
findElement(QName id)
Finds an element of the given id on this element or any adaptations.
|
java.lang.Object |
generateValue(Element element,
ElementMetadata<?,?> metadata)
Generate the value of this property on the given element.
|
java.util.Collection<AttributeKey<?>> |
getAttributes()
Returns an immutable collection of attribute keys in declaration order.
|
ElementMetadata.Cardinality |
getCardinality()
Returns the cardinality of this element.
|
MetadataContext |
getContext()
Returns the metadata context that this metadata was created for, or
null if this metadata is not part of a context. |
XmlNamespace |
getDefaultNamespace()
Returns the best namespace to use as the default in documents if this
element is the root type.
|
java.util.Collection<ElementKey<?,?>> |
getElements()
Returns an immutable set of child keys in declaration order.
|
ElementKey<D,E> |
getKey()
Returns the element key that this element is bound to.
|
ElementMetadata.MultipleVirtualElement |
getMultipleVirtualElement()
Returns the virtual element associated with this metadata with repeated
cardinality.
|
QName |
getName()
Returns the qualified name of the property, used during parsing and
generation.
|
ElementKey<?,?> |
getParent()
Returns the parent of this metadata instance, or
null if this
metadata does not take the parent key into account. |
java.lang.Object |
getProperties()
Returns the object properties associated with this metadata.
|
java.util.Collection<XmlNamespace> |
getReferencedNamespaces()
Returns an immutable collection of the namespaces that are referenced by
this element, its attributes, and recursively within any declared children.
|
Schema |
getSchema()
Returns the
Schema that this metadata is a part of. |
ElementMetadata.SingleVirtualElement |
getSingleVirtualElement()
Returns the virtual element associated with this metadata with single
cardinality.
|
ElementValidator |
getValidator()
Returns an element validator that can be used to validate this content.
|
boolean |
isContentRequired()
Returns true if the text content of this element is required.
|
boolean |
isDeclared(AttributeKey<?> key)
Returns true if this metadata declares the given attribute.
|
boolean |
isDeclared(ElementKey<?,?> element)
Returns true if this metadata declares the given child element.
|
boolean |
isFlattened()
Returns
true if the element has been flattened, which means its
value should be output directly in its parent. |
boolean |
isReferenced()
Returns true if the element type is referenced to generate the the output
representation of the element type.
|
boolean |
isRequired()
Returns true if this property is required.
|
boolean |
isSelected(Element e)
Returns true if the element instance is selected for use in the current
operation.
|
boolean |
isVisible()
Returns true if this property is visible.
|
void |
parseValue(Element element,
ElementMetadata<?,?> metadata,
java.lang.Object value)
Parses the value of this property into the given element.
|
void |
validate(ValidationContext vc,
Element e)
Validates an element using the specified validation context and the
element validator associated with this element metadata.
|
protected abstract ElementMetadata<D,E> delegate()
public ElementKey<?,?> adapt(java.lang.String kind)
ElementMetadata
null
if no adaptation
was found.adapt
in interface ElementMetadata<D,E extends Element>
public ElementMetadata<D,E> bind(MetadataContext context)
ElementMetadata
bind
in interface ElementMetadata<D,E extends Element>
public <K> AttributeMetadata<K> bindAttribute(AttributeKey<K> key)
ElementMetadata
null
if no such attribute is declared.bindAttribute
in interface ElementMetadata<D,E extends Element>
public <K,L extends Element> ElementMetadata<K,L> bindElement(ElementKey<K,L> key)
ElementMetadata
null
if no such element is declared.bindElement
in interface ElementMetadata<D,E extends Element>
public E createElement() throws ContentCreationException
ElementMetadata
createElement
in interface ElementMetadata<D,E extends Element>
ContentCreationException
- if the element could not be created.public AttributeKey<?> findAttribute(QName id)
ElementMetadata
findAttribute
in interface ElementMetadata<D,E extends Element>
public ElementKey<?,?> findElement(QName id)
ElementMetadata
findElement
in interface ElementMetadata<D,E extends Element>
public java.util.Collection<AttributeKey<?>> getAttributes()
ElementMetadata
getAttributes
in interface ElementMetadata<D,E extends Element>
public ElementMetadata.Cardinality getCardinality()
ElementMetadata
getCardinality
in interface ElementMetadata<D,E extends Element>
public java.util.Collection<ElementKey<?,?>> getElements()
ElementMetadata
getElements
in interface ElementMetadata<D,E extends Element>
public ElementKey<D,E> getKey()
ElementMetadata
public java.lang.Object getProperties()
ElementMetadata
getProperties
in interface ElementMetadata<D,E extends Element>
public ElementValidator getValidator()
ElementMetadata
getValidator
in interface ElementMetadata<D,E extends Element>
public boolean isContentRequired()
ElementMetadata
isContentRequired
in interface ElementMetadata<D,E extends Element>
public boolean isDeclared(AttributeKey<?> key)
ElementMetadata
isDeclared
in interface ElementMetadata<D,E extends Element>
public boolean isDeclared(ElementKey<?,?> element)
ElementMetadata
isDeclared
in interface ElementMetadata<D,E extends Element>
public boolean isReferenced()
ElementMetadata
isReferenced
in interface ElementMetadata<D,E extends Element>
public boolean isSelected(Element e)
ElementMetadata
isSelected
in interface ElementMetadata<D,E extends Element>
public boolean isFlattened()
ElementMetadata
true
if the element has been flattened, which means its
value should be output directly in its parent.isFlattened
in interface ElementMetadata<D,E extends Element>
public void validate(ValidationContext vc, Element e)
ElementMetadata
validate
in interface ElementMetadata<D,E extends Element>
vc
- validation context.e
- element to be validate.public java.lang.Object generateValue(Element element, ElementMetadata<?,?> metadata)
Metadata
generateValue
in interface Metadata<D>
public MetadataContext getContext()
Metadata
null
if this metadata is not part of a context.getContext
in interface Metadata<D>
public QName getName()
Metadata
public ElementKey<?,?> getParent()
Metadata
null
if this
metadata does not take the parent key into account.public Schema getSchema()
Metadata
Schema
that this metadata is a part of.public boolean isRequired()
Metadata
isRequired
in interface Metadata<D>
public boolean isVisible()
Metadata
public void parseValue(Element element, ElementMetadata<?,?> metadata, java.lang.Object value) throws ParseException
Metadata
parseValue
in interface Metadata<D>
ParseException
- if parsing fails.public ElementMetadata.MultipleVirtualElement getMultipleVirtualElement()
ElementMetadata
getMultipleVirtualElement
in interface ElementMetadata<D,E extends Element>
public ElementMetadata.SingleVirtualElement getSingleVirtualElement()
ElementMetadata
getSingleVirtualElement
in interface ElementMetadata<D,E extends Element>
public XmlNamespace getDefaultNamespace()
ElementMetadata
getDefaultNamespace
in interface ElementMetadata<D,E extends Element>
public java.util.Collection<XmlNamespace> getReferencedNamespaces()
ElementMetadata
getReferencedNamespaces
in interface ElementMetadata<D,E extends Element>