public abstract class

ForwardingElementMetadata

extends Object
implements ElementMetadata<D, E extends Element>
java.lang.Object
   ↳ com.google.gdata.model.ForwardingElementMetadata<D, E extends com.google.gdata.model.Element>

Class Overview

The ForwardingElementMetadata abstract class provides a simple delegating ElementMetadata implementation. It can be subclassed to create transient element metadata instances that override or modify selected behaviors without requiring the creation of a new registered metadata type.

Summary

Public Constructors
ForwardingElementMetadata()
Public Methods
ElementKey<?, ?> adapt(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> ElementMetadata<K, L> 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.
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.
Object generateValue(Element element, ElementMetadata<?, ?> metadata)
Generate the value of this property on the given element.
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.
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.
Object getProperties()
Returns the object properties associated with this metadata.
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(ElementKey<?, ?> element)
Returns true if this metadata declares the given child element.
boolean isDeclared(AttributeKey<?> key)
Returns true if this metadata declares the given attribute.
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, 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 Methods
abstract ElementMetadata<D, E> delegate()
Returns the delegate element metadata instance that is the delegation target for this forwarding instance.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.model.ElementMetadata
From interface com.google.gdata.model.Metadata

Public Constructors

public ForwardingElementMetadata ()

Public Methods

public ElementKey<?, ?> adapt (String kind)

Adapts this metadata to another type, based on the given kind. Will return the element key that the kind represents, or null if no adaptation was found.

Parameters
kind

public ElementMetadata<D, E> bind (MetadataContext context)

Binds this element metadata to the given context.

Parameters
context

public AttributeMetadata<K> bindAttribute (AttributeKey<K> key)

Binds the attribute metadata associated with a particular key. Will return null if no such attribute is declared.

Parameters
key

public ElementMetadata<K, L> bindElement (ElementKey<K, L> key)

Binds the child element metadata associated with a particular key. Will return null if no such element is declared.

Parameters
key

public E createElement ()

Create an element with this metadata as the metadata for the element.

public AttributeKey<?> findAttribute (QName id)

Finds an attribute of the given id on this element or any adaptations. This can be used to find appropriate attribute metadata to parse into while parsing an element. This will include attributes that are not declared as part of this metadata, but are declared on adaptations.

Parameters
id

public ElementKey<?, ?> findElement (QName id)

Finds an element of the given id on this element or any adaptations. This can be used to find appropriate element metadata to parse into while parsing an element.

Parameters
id

public Object generateValue (Element element, ElementMetadata<?, ?> metadata)

Generate the value of this property on the given element. If the property is virtual, it will be used to generate the value, otherwise the regular property value will be used.

Parameters
element
metadata

public Collection<AttributeKey<?>> getAttributes ()

Returns an immutable collection of attribute keys in declaration order.

public ElementMetadata.Cardinality getCardinality ()

Returns the cardinality of this element.

public MetadataContext getContext ()

Returns the metadata context that this metadata was created for, or null if this metadata is not part of a context.

public XmlNamespace getDefaultNamespace ()

Returns the best namespace to use as the default in documents if this element is the root type.

public Collection<ElementKey<?, ?>> getElements ()

Returns an immutable set of child keys in declaration order.

public ElementKey<D, E> getKey ()

Returns the element key that this element is bound to.

public ElementMetadata.MultipleVirtualElement getMultipleVirtualElement ()

Returns the virtual element associated with this metadata with repeated cardinality. A virtual element represents a completely virtual DOM element that can have its own attributes and child elements, all of which are pulled from elsewhere in the DOM.

public QName getName ()

Returns the qualified name of the property, used during parsing and generation. For atom this will usually be the same as the id, but for json or other alt types it may be different.

Returns
  • the qualified name of the property.

public ElementKey<?, ?> getParent ()

Returns the parent of this metadata instance, or null if this metadata does not take the parent key into account.

public Object getProperties ()

Returns the object properties associated with this metadata.

public Collection<XmlNamespace> getReferencedNamespaces ()

Returns an immutable collection of the namespaces that are referenced by this element, its attributes, and recursively within any declared children.

public Schema getSchema ()

Returns the Schema that this metadata is a part of.

public ElementMetadata.SingleVirtualElement getSingleVirtualElement ()

Returns the virtual element associated with this metadata with single cardinality. A virtual element represents a completely virtual DOM element that can have its own attributes and child elements, all of which are pulled from elsewhere in the DOM.

public ElementValidator getValidator ()

Returns an element validator that can be used to validate this content.

public boolean isContentRequired ()

Returns true if the text content of this element is required.

public boolean isDeclared (ElementKey<?, ?> element)

Returns true if this metadata declares the given child element.

Parameters
element

public boolean isDeclared (AttributeKey<?> key)

Returns true if this metadata declares the given attribute.

Parameters
key

public boolean isFlattened ()

Returns true if the element has been flattened, which means its value should be output directly in its parent.

public boolean isReferenced ()

Returns true if the element type is referenced to generate the the output representation of the element type. This generally means that the element may be visible or is required to evaluate a selection condition.

public boolean isRequired ()

Returns true if this property is required. If a property is required it must appear in its parent element for that parent element to be valid.

Returns
  • true if the property is required in its parent element.

public boolean isSelected (Element e)

Returns true if the element instance is selected for use in the current operation.

Parameters
e

public boolean isVisible ()

Returns true if this property is visible. If a property is visible it will be included in the output generation for its parent element, if it is hidden (not visible) it will not be included.

Returns
  • true if the property is visible in its parent element.

public void parseValue (Element element, ElementMetadata<?, ?> metadata, Object value)

Parses the value of this property into the given element. If the property is virtual, it will be used to parse the value, otherwise the value will be stored directly in the property.

Parameters
element
metadata
value

public void validate (ValidationContext vc, Element e)

Validates an element using the specified validation context and the element validator associated with this element metadata.

Parameters
vc Validation context.
e Element to be validate.

Protected Methods

protected abstract ElementMetadata<D, E> delegate ()

Returns the delegate element metadata instance that is the delegation target for this forwarding instance.