com.google.gdata.model
Interface Metadata<D>

Type Parameters:
D - data type of the metadata. This defines the type of value that the property can contain, which is available through getKey().
All Known Subinterfaces:
AttributeMetadata<D>, ElementMetadata<D,E>
All Known Implementing Classes:
ForwardingElementMetadata

public interface Metadata<D>

The Metadata interface defines operations that are common to all content model properties (elements or attributes). This interface describes the id, name and datatype of a property, as well as including flags for whether the property is required, undeclared, or visible. Creating new instances of Metadata should be done using Schema.


Nested Class Summary
static interface Metadata.VirtualValue
          Defines a virtual value.
 
Method Summary
 java.lang.Object generateValue(Element element, ElementMetadata<?,?> metadata)
          Generate the value of this property on the given element.
 MetadataContext getContext()
          Returns the metadata context that this metadata was created for, or null if this metadata is not part of a context.
 MetadataKey<D> getKey()
          Returns the attribute key for this metadata.
 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.
 Schema getSchema()
          Returns the Schema that this metadata is a part of.
 boolean isRequired()
          Returns true if this property is required.
 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.
 

Method Detail

getSchema

Schema getSchema()
Returns the Schema that this metadata is a part of.


getKey

MetadataKey<D> getKey()
Returns the attribute key for this metadata.


getParent

ElementKey<?,?> getParent()
Returns the parent of this metadata instance, or null if this metadata does not take the parent key into account.


getContext

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


getName

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.

isRequired

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.

isVisible

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.

generateValue

java.lang.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.


parseValue

void parseValue(Element element,
                ElementMetadata<?,?> metadata,
                java.lang.Object value)
                throws ParseException
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.

Throws:
ParseException - if parsing fails.