public final class MetadataFactory extends Object
Metadata may be modelled for the type of topic data that it is going to represent.
Metadata modelling is not currently supported for all types of Topic Data.
If metadata is to be used for Topics then it is highly recommended that each top level metadata occurrence has a unique name as this allows for certain optimisations like metadata caching.
Modifier and Type | Method and Description |
---|---|
static MNode |
decodeFromXML(String xml)
Parse metadata from XML.
|
static String |
encodeAsXML(MNode metadata)
Encode metadata as XML.
|
static String |
encodeAsXML(MNode metadata,
boolean format)
Encode metadata as XML.
|
static MField |
newCustomFieldMetadata(CustomFieldHandler handler)
Create a single custom metadata field with an automatically generated
unique name.
|
static MField |
newCustomFieldMetadata(String handler)
Create a single custom metadata field with an automatically generated
unique name.
|
static MField |
newCustomFieldMetadata(String name,
CustomFieldHandler handler)
Create a single custom metadata field.
|
static MField |
newCustomFieldMetadata(String name,
String handler)
Create a single custom metadata field.
|
static MField |
newFieldMetadata(MDataType dataType)
This is a convenience method for constructing a single metadata field
with an automatically generated unique name.
|
static MField |
newFieldMetadata(String name,
MDataType dataType)
This is a convenience method for constructing a single metadata field.
|
static MMessage |
newMessageMetadata(String name)
Create a new empty message metadata node of type
Record for metadata modeling. |
static MMessage |
newMetadata(String name,
TopicDataType topicDataType)
Deprecated.
|
static MRecord |
newRecordMetadata(String name)
This is a convenience method for creating Record metadata.
|
@Deprecated public static MMessage newMetadata(String name, TopicDataType topicDataType) throws APIException
newMessageMetadata(String)
name
- the message name. It is recommended that every metadata item
created has a unique name.topicDataType
- the data type for the metadata. The capabilities of
the metadata may vary according to the data type.APIException
- if unable to create metadata of the specified type.public static MMessage newMessageMetadata(String name) throws APIException
Record
for metadata modeling.
name
- the message name. It is recommended that every metadata item
created has a unique name.APIException
- if unable to create metadata of the specified type.public static MRecord newRecordMetadata(String name) throws APIException
This can be used for simple record handling where multiple records per message are not required.
name
- the record name. It is recommended that every metadata item
created has a unique name.APIException
- if unable to create metadata with the given namepublic static MField newFieldMetadata(MDataType dataType) throws APIException
This can only be used for define data types and not for a custom data
type for which newCustomFieldMetadata(CustomFieldHandler)
should
be used.
After creating such a field it can be modified. For example to specify an initial value.
dataType
- the field data typeAPIException
- if unable to createpublic static MField newFieldMetadata(String name, MDataType dataType) throws APIException
This can only be used for define data types and not for a custom data
type for which newCustomFieldMetadata(CustomFieldHandler)
should
be used.
After creating such a field it can be modified. For example to specify an initial value.
name
- the field name. It is recommended that every metadata item
has a unique name.dataType
- the field data typeAPIException
- if unable to createpublic static MField newCustomFieldMetadata(CustomFieldHandler handler) throws APIException
handler
- a custom data handler instance.APIException
- if no handler specifiedpublic static MField newCustomFieldMetadata(String name, CustomFieldHandler handler) throws APIException
name
- the field name. It is recommended that every metadata item
has a unique name.handler
- a custom data handler instance.APIException
- if no handler specifiedpublic static MField newCustomFieldMetadata(String handler) throws APIException
handler
- the class name from which a CustomFieldHandler may be
instantiatedAPIException
- if no handler class specified or an instance of the
class could not be instantiatedpublic static MField newCustomFieldMetadata(String name, String handler) throws APIException
name
- the field name. It is recommended that every metadata item
has a unique name.handler
- the class name from which a CustomFieldHandler may be
instantiatedAPIException
- if no handler class specified or an instance of the
class could not be instantiatedpublic static String encodeAsXML(MNode metadata) throws APIException
Equivalent to calling encodeAsXML( message, false )
metadata
- metadata node to encodeAPIException
- if mapping and serialization failspublic static String encodeAsXML(MNode metadata, boolean format) throws APIException
metadata
- metadata node to encodeformat
- request XML marshaller to format XMLAPIException
- if mapping and serialization failspublic static MNode decodeFromXML(String xml) throws APIException
The XML may have been created using encodeAsXML(MNode)
.
xml
- XML document holding the metadata structureAPIException
- thrown if parsing is not possibleCopyright © 2016 Push Technology Ltd. All Rights Reserved.