| com.google.gdata.model.ElementCreator |
An element creator allows setting element information, which includes the following pieces:
ElementKey associated with the metadata. Setting the
name here will override the default.ElementMetadata.Cardinality for the valid values. Defaults to
SINGLE.ElementKey has a datatype other than
Void.MetadataValidator is used.null.Metadata.VirtualValue.addAttribute(AttributeKey>) or replaceAttribute(AttributeKey>), based on the desired
order in the output.addElement(ElementKey, ?>) or replaceElement(ElementKey, ?>),
based on the desired order in the output.| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Adds an adaptation from the element type of this element to the adaptation
type.
| |||||||||||
Add the key for an attribute.
| |||||||||||
Add the metadata for a child element.
| |||||||||||
Sets the location of the undeclared attributes.
| |||||||||||
Sets the location of the undeclared elements.
| |||||||||||
Blacklist a set of keys, these keys will be explicitly hidden from view.
| |||||||||||
Flattens this element.
| |||||||||||
Adds a new virtual attribute based on a path.
| |||||||||||
Adds a new virtual element based on a path.
| |||||||||||
Sets a list of attributes as the only visible attributes for an element,
and also places them into the given order in the element.
| |||||||||||
Sets a list of elements as the only visible child elements for an element,
and also places them into the given order in the element.
| |||||||||||
Replaces the existing metadata for an attribute.
| |||||||||||
Replaces the existing metadata for a child element.
| |||||||||||
Sets the cardinality of the element.
| |||||||||||
Sets whether the element's content is required.
| |||||||||||
Sets this metadata as representing a virtual element with multiple
cardinality.
| |||||||||||
Sets the name of the element.
| |||||||||||
Sets the element's properties.
| |||||||||||
Sets the requiredness of this element.
| |||||||||||
Sets this metadata as representing a virtual element with single
cardinality.
| |||||||||||
Sets the element's validator.
| |||||||||||
Sets the virtual text content of this element.
| |||||||||||
Sets whether this element is visible.
| |||||||||||
Whitelists a set of attributes for this element metadata.
| |||||||||||
Whitelists a set of child elements for this element metadata.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.google.gdata.model.MetadataCreator
| |||||||||||
Adds an adaptation from the element type of this element to the adaptation
type. An adaptation is a customization of a base type to a particular
variant type. Adaptations are used to allow adaptive parsing; the data is
first parsed into the base type and then adapted to a more specific variant
during resolution. If you are adding adaptations you should also override
narrow(ElementMetadata, ?>, ValidationContext) and call
adapt(Element, ElementMetadata, String) with the
appropriate key.
| kind | |
|---|---|
| adaptation |
Add the key for an attribute. If an attribute with the same ID
already exists, the previous attribute will be removed, and the new
attribute will be added to the end of the list. If you want to replace the
existing element, use replaceAttribute(AttributeKey).
| key | The key to the attribute that is being added. |
|---|
Add the metadata for a child element. If an element with the same ID
already exists, the previous element will be removed, and the new element
will be added to the end of the list. If you want to replace the existing
element, use replaceElement(ElementKey).
| element | The key we are adding or pushing to the end. |
|---|
Sets the location of the undeclared attributes. By default, undeclared attributes appear after all declared attributes, this lets them appear earlier in the list.
Sets the location of the undeclared elements. By default, undeclared elements appear after all declared elements, this lets them appear earlier in the list.
Blacklist a set of keys, these keys will be explicitly hidden from view.
| keys |
|---|
Flattens this element. If the element has text content, this method will
cause its text content to be output as part of any parent element, rather
than as a separate nested element. Any attributes or child elements of
this element will not be generated on output, if you wish to output those
elements use the moveAttribute(AttributeKey>, Path) and moveElement(ElementKey, ?>, Path) methods to
place them somewhere else.
Adds a new virtual attribute based on a path. The path is relative to this element and must end in an attribute key. For example, if you want to add the atom:title@type attribute to entry, you could do:
registry.build(Entry.KEY).addVirtual(
TextContent.TYPE, Path.of(Entry.TITLE, TextContent.TYPE));
Adding a virtual attribute will hide the source attribute in the output, but any changes made to the source will also be applied to the virtual location.
| key | |
|---|---|
| path |
| IllegalArgumentException | if the path does not end in an attribute. |
|---|
Adds a new virtual element based on a path. The path is relative to this element and must end in an element key. For example, if you want to add the media:keywords element to media:group, you could do:
registry.build(Entry.KEY).addVirtual(
MediaKeyword.KEY, Path.of(MediaGroup.KEY, MediaKeyword.KEY));
Adding a virtual element will hide the source element in the output, but any changes made to the source will also be applied to the virtual location.
| key | |
|---|---|
| path |
| IllegalArgumentException | if the path does not end in an element. |
|---|
Sets a list of attributes as the only visible attributes for an element, and also places them into the given order in the element.
| keys |
|---|
Sets a list of elements as the only visible child elements for an element, and also places them into the given order in the element.
| keys |
|---|
Replaces the existing metadata for an attribute.
| key | The key to the attribute that is being replaced. |
|---|
Replaces the existing metadata for a child element.
| key | The key we are replacing. |
|---|
| IllegalArgumentException | if the child metadata doesn't exist. |
|---|
Sets whether the element's content is required. By default the content is required if the datatype is not Void.
| contentRequired | True to set the content to required, false to set it to optional. |
|---|
Sets this metadata as representing a virtual element with multiple cardinality. A virtual element is an element that only exists in the metadata, and is used during parsing and generation to map to the base DOM.
| virtualElement |
|---|
Sets the name of the element. This can be used after copying some other metadata to change the name.
| name | The new name to use for the element. |
|---|
Sets the element's properties. This is used to provide additional information during parsing/generation, and is specific to the wire format.
| properties | Default properties for the element. |
|---|
Sets the requiredness of this element. This means that the element must appear in the parent element for the parent element to be valid.
| required | True to set the element to required, false to set it to optional (the default). |
|---|
Sets this metadata as representing a virtual element with single cardinality. A virtual element is an element that only exists in the metadata, and is used during parsing and generation to map to the base DOM.
| virtualElement |
|---|
Sets the element's validator. The validator is used to check that the
element has all required attributes/elements/values. By default an
instance of MetadataValidator is used.
| validator | Element validator to use when validating the element, or null if no validation is needed (for undeclared metadata). |
|---|
Sets the virtual text content of this element. This can change how the
text content of the element is rendered, but cannot be used for structural
changes to the element. For that use setSingleVirtualElement(ElementMetadata.SingleVirtualElement)
or setMultipleVirtualElement(ElementMetadata.MultipleVirtualElement).
| virtualValue |
|---|
Sets whether this element is visible. If the element is not visible then it will not be included in the output. This can be used to set the state of an element to hidden if it is not part of the default set of metadata.
| visible | True to make the property visible (the default), false to hide it from the output. |
|---|
Whitelists a set of attributes for this element metadata. This will hide all declared attributes on the metadata instance that will be created from this builder. This will not change the current order.
| keys |
|---|
Whitelists a set of child elements for this element metadata. This will hide all declared child elements on the metadata instance that will be created from this builder. This will not change the current order.
| keys |
|---|