|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface 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
ElementMetadata.Cardinality.SINGLE.ElementKey has a datatype other than
Void.MetadataValidator is used.null.Metadata.VirtualValue.addAttribute(com.google.gdata.model.AttributeKey>) or replaceAttribute(com.google.gdata.model.AttributeKey>), based on the desired
order in the output.addElement(com.google.gdata.model.ElementKey, ?>) or replaceElement(com.google.gdata.model.ElementKey, ?>),
based on the desired order in the output.
| Method Summary | |
|---|---|
ElementCreator |
adapt(java.lang.String kind,
ElementKey<?,?> adaptation)
Adds an adaptation from the element type of this element to the adaptation type. |
AttributeCreator |
addAttribute(AttributeKey<?> key)
Add the key for an attribute. |
ElementCreator |
addElement(ElementKey<?,?> element)
Add the metadata for a child element. |
ElementCreator |
addUndeclaredAttributeMarker()
Sets the location of the undeclared attributes. |
ElementCreator |
addUndeclaredElementMarker()
Sets the location of the undeclared elements. |
ElementCreator |
blacklistElements(ElementKey<?,?>... keys)
Blacklist a set of keys, these keys will be explicitly hidden from view. |
ElementCreator |
flatten()
Flattens this element. |
AttributeCreator |
moveAttribute(AttributeKey<?> key,
Path path)
Adds a new virtual attribute based on a path. |
ElementCreator |
moveElement(ElementKey<?,?> key,
Path path)
Adds a new virtual element based on a path. |
ElementCreator |
orderAndWhitelistAttributes(AttributeKey<?>... keys)
Sets a list of attributes as the only visible attributes for an element, and also places them into the given order in the element. |
ElementCreator |
orderAndWhitelistElements(ElementKey<?,?>... 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. |
AttributeCreator |
replaceAttribute(AttributeKey<?> key)
Replaces the existing metadata for an attribute. |
ElementCreator |
replaceElement(ElementKey<?,?> key)
Replaces the existing metadata for a child element. |
ElementCreator |
setCardinality(ElementMetadata.Cardinality cardinality)
Sets the cardinality of the element. |
ElementCreator |
setContentRequired(boolean contentRequired)
Sets whether the element's content is required. |
ElementCreator |
setMultipleVirtualElement(ElementMetadata.MultipleVirtualElement virtualElement)
Sets this metadata as representing a virtual element with multiple cardinality. |
ElementCreator |
setName(QName name)
Sets the name of the element. |
ElementCreator |
setProperties(java.lang.Object properties)
Sets the element's properties. |
ElementCreator |
setRequired(boolean required)
Sets the requiredness of this element. |
ElementCreator |
setSingleVirtualElement(ElementMetadata.SingleVirtualElement virtualElement)
Sets this metadata as representing a virtual element with single cardinality. |
ElementCreator |
setValidator(ElementValidator validator)
Sets the element's validator. |
ElementCreator |
setVirtualValue(Metadata.VirtualValue virtualValue)
Sets the virtual text content of this element. |
ElementCreator |
setVisible(boolean visible)
Sets whether this element is visible. |
ElementCreator |
whitelistAttributes(AttributeKey<?>... keys)
Whitelists a set of attributes for this element metadata. |
ElementCreator |
whitelistElements(ElementKey<?,?>... keys)
Whitelists a set of child elements for this element metadata. |
| Method Detail |
|---|
ElementCreator setName(QName name)
setName in interface MetadataCreatorname - the new name to use for the element.
ElementCreator setRequired(boolean required)
setRequired in interface MetadataCreatorrequired - true to set the element to required, false to set it
to optional (the default).
ElementCreator setVisible(boolean visible)
setVisible in interface MetadataCreatorvisible - true to make the property visible (the default), false to
hide it from the output.
ElementCreator adapt(java.lang.String kind,
ElementKey<?,?> adaptation)
Element.narrow(com.google.gdata.model.ElementMetadata, ?>, com.google.gdata.model.ValidationContext) and call
Element.adapt(Element, ElementMetadata, String) with the
appropriate key.
ElementCreator setCardinality(ElementMetadata.Cardinality cardinality)
ElementMetadata.Cardinality.SINGLE for only a single element, or
ElementMetadata.Cardinality.MULTIPLE for repeating elements.
cardinality - the cardinality of the element.
ElementCreator setContentRequired(boolean contentRequired)
Void.
contentRequired - true to set the content to required, false to set
it to optional.
ElementCreator setValidator(ElementValidator validator)
MetadataValidator is used.
validator - element validator to use when validating the element, or
null if no validation is needed (for undeclared metadata).
ElementCreator setProperties(java.lang.Object properties)
properties - default properties for the element.
ElementCreator setVirtualValue(Metadata.VirtualValue virtualValue)
setSingleVirtualElement(com.google.gdata.model.ElementMetadata.SingleVirtualElement)
or setMultipleVirtualElement(com.google.gdata.model.ElementMetadata.MultipleVirtualElement).
setVirtualValue in interface MetadataCreatorElementCreator setSingleVirtualElement(ElementMetadata.SingleVirtualElement virtualElement)
ElementCreator setMultipleVirtualElement(ElementMetadata.MultipleVirtualElement virtualElement)
ElementCreator flatten()
moveAttribute(com.google.gdata.model.AttributeKey>, com.google.gdata.model.Path) and moveElement(com.google.gdata.model.ElementKey, ?>, com.google.gdata.model.Path) methods to
place them somewhere else.
AttributeCreator moveAttribute(AttributeKey<?> key,
Path path)
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.
java.lang.IllegalArgumentException - if the path does not end in an attribute.
ElementCreator moveElement(ElementKey<?,?> key,
Path path)
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.
java.lang.IllegalArgumentException - if the path does not end in an element.ElementCreator addUndeclaredAttributeMarker()
AttributeCreator addAttribute(AttributeKey<?> key)
replaceAttribute(AttributeKey).
key - the key to the attribute that is being added.
AttributeCreator replaceAttribute(AttributeKey<?> key)
key - the key to the attribute that is being replaced.
ElementCreator orderAndWhitelistAttributes(AttributeKey<?>... keys)
ElementCreator whitelistAttributes(AttributeKey<?>... keys)
ElementCreator addUndeclaredElementMarker()
ElementCreator addElement(ElementKey<?,?> element)
replaceElement(ElementKey).
element - the key we are adding or pushing to the end.
ElementCreator replaceElement(ElementKey<?,?> key)
key - the key we are replacing.
java.lang.IllegalArgumentException - if the child metadata doesn't exist.ElementCreator orderAndWhitelistElements(ElementKey<?,?>... keys)
ElementCreator whitelistElements(ElementKey<?,?>... keys)
ElementCreator blacklistElements(ElementKey<?,?>... keys)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||