public interface MetadataFactory
If metadata is to be used for topics, it is highly recommended that each top level metadata occurrence has a unique name as this allows for certain optimisations like metadata caching.
An instance of the factory may be obtained using Diffusion.metadata()
.
Modifier and Type | Method and Description |
---|---|
MContent |
content(String name,
MRecord... records)
Creates a new content metadata definition comprising the supplied record
definitions, each with single multiplicity.
|
MContent.Builder |
contentBuilder(String name)
Creates a new content metadata builder.
|
MCustomString.Builder |
customBuilder(String name,
String handler)
Create a new custom field metadata builder.
|
MCustomString |
customString(String name,
String handlerClass)
Convenience method to build a custom field metadata definition.
|
MDecimalString |
decimal(String name)
Convenience method to build a decimal field metadata definition with
default scale of 2.
|
MDecimalString |
decimal(String name,
BigDecimal defaultValue)
Convenience method to build a decimal field metadata definition with a
default value and a scale of 2.
|
MDecimalString |
decimal(String name,
double defaultValue)
Deprecated.
since 5.7 - do not use this method as double representation
is not precise. Use
decimal(String, String) instead. |
MDecimalString |
decimal(String name,
String defaultValue)
Convenience method to build a decimal field metadata definition with a
default value and a scale of 2.
|
MDecimalString.Builder |
decimalBuilder(String name)
Create a new decimal field metadata builder.
|
MNode |
decodeFromXML(String xml)
Parse metadata from XML.
|
String |
encodeAsXML(MNode metadata)
Encode metadata as XML.
|
String |
encodeAsXML(MNode metadata,
boolean format)
Encode metadata as XML.
|
MIntegerString |
integer(String name)
Convenience method to build an integer field metadata definition.
|
MIntegerString |
integer(String name,
BigInteger defaultValue)
Convenience method to build an integer field metadata definition with a
supplied default value.
|
MIntegerString |
integer(String name,
int defaultValue)
Convenience method to build an integer field metadata definition with a
supplied default value.
|
MIntegerString |
integer(String name,
String defaultValue)
Convenience method to build an integer field metadata definition with a
supplied default value.
|
MIntegerString.Builder |
integerBuilder(String name)
Create a new integer field metadata builder.
|
MRecord |
record(String name,
MField... fields)
Creates a new record metadata definition comprising the supplied fields,
each with single multiplicity.
|
MRecord.Builder |
recordBuilder(String name)
Creates a new record metadata builder.
|
MString |
string(String name)
Convenience method to build a string field metadata definition.
|
MString |
string(String name,
String defaultValue)
Convenience method to build a string field metadata definition with a
default value.
|
MString.Builder |
stringBuilder(String name)
Creates a new string field metadata builder.
|
MDecimalString.Builder decimalBuilder(String name) throws IllegalArgumentException
name
- the field nameIllegalArgumentException
- if name
is null or invalidMString.Builder stringBuilder(String name) throws IllegalArgumentException
name
- the name of the fieldIllegalArgumentException
- if name
is null or invalidMRecord.Builder recordBuilder(String name) throws IllegalArgumentException
name
- the name of the recordIllegalArgumentException
- if name
is null or invalidMRecord record(String name, MField... fields) throws IllegalArgumentException, MetadataViolationException
name
- the record namefields
- array of field metadata definitions each representing a
single occurrence field within the record in the order supplied.IllegalArgumentException
- if name
is null or invalid or no
fields supplied or if any of the fields are nullMetadataViolationException
- if a metadata rule (such as no
duplicates or a nesting rule violation) is brokenMIntegerString.Builder integerBuilder(String name) throws IllegalArgumentException
name
- the field nameIllegalArgumentException
- if name
is null or invalidMCustomString.Builder customBuilder(String name, String handler) throws IllegalArgumentException
name
- the field namehandler
- the full handler class name. This must specify the name of
a class available at the server which will be instantiated to
handle the field. The class must implement the required
CustomFieldHandler interfaceIllegalArgumentException
- if either name
or
handler
are nullMContent.Builder contentBuilder(String name) throws IllegalArgumentException
name
- the content metadata nameIllegalArgumentException
- if name
is null or invalidMContent content(String name, MRecord... records) throws IllegalArgumentException, MetadataViolationException
name
- the content definition namerecords
- array of record definitions representing single occurrence
record instances within the content in the order specifiedIllegalArgumentException
- if name
is null or invalid or no
records supplied or if any of the records are nullMetadataViolationException
- if a metadata rule (such as no
duplicates or a nesting rule violation) is brokenMString string(String name) throws IllegalArgumentException
name
- the field nameIllegalArgumentException
- if name
is null or invalidMString string(String name, String defaultValue) throws IllegalArgumentException
name
- the field namedefaultValue
- the default valueIllegalArgumentException
- if name
is null or invalidMDecimalString decimal(String name) throws IllegalArgumentException
name
- the field nameIllegalArgumentException
- if name
is null or invalidMDecimalString decimal(String name, String defaultValue) throws IllegalArgumentException
name
- the field namedefaultValue
- the default value which must be valid decimal number
representationIllegalArgumentException
- if either name
or
defaultValue
are null or invalid@Deprecated MDecimalString decimal(String name, double defaultValue) throws IllegalArgumentException
decimal(String, String)
instead.name
- the field namedefaultValue
- the default valueIllegalArgumentException
- if name
is null or invalidMDecimalString decimal(String name, BigDecimal defaultValue) throws IllegalArgumentException
name
- the field namedefaultValue
- the default value which must be valid decimal number
representationIllegalArgumentException
- if either name
or
defaultValue
are null or invalidMIntegerString integer(String name) throws IllegalArgumentException
name
- the field nameIllegalArgumentException
- if name
is null or invalidMIntegerString integer(String name, String defaultValue) throws IllegalArgumentException
name
- the field namedefaultValue
- the default value as a string. This must be a valid
integer number representationIllegalArgumentException
- if either name
or
defaultValue
is null or invalidMIntegerString integer(String name, int defaultValue) throws IllegalArgumentException
name
- the field namedefaultValue
- the default valueIllegalArgumentException
- if either name
or
defaultValue
is null or invalidMIntegerString integer(String name, BigInteger defaultValue) throws IllegalArgumentException
name
- the field namedefaultValue
- the default valueIllegalArgumentException
- if either name
or
defaultValue
is null or invalidMCustomString customString(String name, String handlerClass) throws IllegalArgumentException
name
- the field namehandlerClass
- the full name of the handler class available at the
serverIllegalArgumentException
- if name
or handlerClass
is null or invalidString encodeAsXML(MNode metadata) throws JAXBException, IllegalArgumentException
Equivalent to calling encodeAsXML(MNode, boolean)
with
format=false
.
metadata
- the top level node with the metadata definition to encodeIllegalArgumentException
- if metadata
is null or a type
that can not be encodedJAXBException
- if there is a JAXB error whilst encodingString encodeAsXML(MNode metadata, boolean format) throws JAXBException, IllegalArgumentException
metadata
- the top level node with the metadata definition to encodeformat
- indicates whether XML should be formattedIllegalArgumentException
- if metadata
is null or of a type
that can not be encodedJAXBException
- if there is a JAXB error whilst encodingMNode decodeFromXML(String xml) throws IllegalArgumentException, JAXBException
The XML may have been created using encodeAsXML(MNode)
.
xml
- a string containing an XML definition of metadataIllegalArgumentException
- if xml
is nullJAXBException
- if there is a JAXB error whilst decodingCopyright © 2016 Push Technology Ltd. All Rights Reserved.