| java.lang.Object | |
| ↳ | com.google.gdata.model.MetadataRegistry |
A mutable, thread-safe registry for metadata. This should be used
to construct the default metadata for elements and attributes, the transforms
on those default metadata instances, and any adaptations on the element
types. The createSchema() method can be called to construct an
immutable Schema from this builder.
Thread safety is guaranteed by always guarding access to the element and attribute maps by synchronizing on the builder itself. The individual element and attribute registries are also thread safe.
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| attributes | |||||||||||
| cachedSchema | |||||||||||
| elements | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new empty metadata registry.
| |||||||||||
Copy constructor, creates a copy of the given metadata registry.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Adapts from the source type to the adaptation type on the given kind.
| |||||||||||
Builds the metadata for the attribute inside the parent.
| |||||||||||
Builds metadata for when the
key is used in a context compatible
with context. | |||||||||||
Builds element metadata for the given key.
| |||||||||||
Builds the metadata for the attribute inside the parent, during the
context.
| |||||||||||
Builds metadata for when the
key is inside the parent and
used in a context compatible with context. | |||||||||||
Builds metadata for when the
key is inside the parent. | |||||||||||
Creates a
Schema out of this registry. | |||||||||||
Returns
true if the given key has already been registered. | |||||||||||
Merges another metadata registry into this metadata registry.
| |||||||||||
Registers the metadata for an element key.
| |||||||||||
Registers the metadata from an element subclass using its
"registerMetadata" method through reflection.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Constructs a new empty metadata registry.
Copy constructor, creates a copy of the given metadata registry. This is
equivalent to new MetadataRegistry().merge(source).
| source |
|---|
Adapts from the source type to the adaptation type on the given kind.
| source | |
|---|---|
| kind | |
| adaptation |
Builds the metadata for the attribute inside the parent. Note that this
will not declare the attribute as part of the parent element, that must be
done using addAttribute(AttributeKey) or
replaceAttribute(AttributeKey).
| parent | |
|---|---|
| attribute |
Builds metadata for when the key is used in a context compatible
with context.
| element | |
|---|---|
| context |
Builds element metadata for the given key. This will create the default metadata for that key. If the key's element type has a superclass with existing metadata registered at the same ID, the new key will inherit any existing properties.
| element |
|---|
Builds the metadata for the attribute inside the parent, during the
context. Note that this will not declare the attribute as part of the
parent element, that must be done using
addAttribute(AttributeKey) or
replaceAttribute(AttributeKey).
| parent | |
|---|---|
| attribute | |
| context |
Builds metadata for when the key is inside the parent and
used in a context compatible with context. Note that this will not
declare the element as part of the parent element, that must be done using
addElement(ElementKey) or
replaceElement(ElementKey).
This will also guarantee that any element types that are referenced have been registered in this registry.
| parent | |
|---|---|
| element | |
| context |
Builds metadata for when the key is inside the parent.
Note that this will not declare the element as part of the parent element,
that must be done using addElement(ElementKey) or
replaceElement(ElementKey).
| parent | |
|---|---|
| element |
Creates a Schema out of this registry. Will return a cached
instance if the registry has not changed since last time create() was
called.
Returns true if the given key has already been registered. This
is used to prevent reentrant metadata registration (and cycles).
| key |
|---|
Merges another metadata registry into this metadata registry. Both registries are locked during this time, first this registry and then the other registry. Do not attempt to do a.merge(b) and b.merge(a) in separate threads at the same time or a deadlock may occur.
| other |
|---|
Registers the metadata for an element key. This will call the
"registerMetadata" method on the Element subclass that the key
refers to, if it refers to a subclass. If it refers to Element directly
it will just build the key.
| key |
|---|
| IllegalArgumentException | if the element type does not support a registration method. |
|---|
Registers the metadata from an element subclass using its "registerMetadata" method through reflection.
| clazz |
|---|