Class XmlMappingMetaData
- java.lang.Object
-
- net.officefloor.plugin.xml.marshall.tree.XmlMappingMetaData
-
public class XmlMappingMetaData extends java.lang.Object
Contains the meta-data of the XML mappings.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
attributeName
Attribute name flagging this mapping, if set, to be an attribute.protected java.lang.String
elementName
Element name for this mapping.protected java.lang.String
getMethodName
Name of method to object the value/object for this mapping.protected java.lang.String
id
Id for referencing.protected boolean
isUseRaw
Indicates if to use the value raw.protected java.util.List<XmlMappingMetaData>
objectMappings
The mappings of the object in current context.protected java.lang.String
staticValue
Static value for the mapping.protected XmlMappingType
type
Type of this Xml Mapping.protected java.lang.String
upperBoundType
Upper bound type of the object that this mapping is sourcing from.
-
Constructor Summary
Constructors Constructor Description XmlMappingMetaData()
Default constructor to allow theTreeXmlUnmarshaller
to configure this.XmlMappingMetaData(XmlMappingType type, java.lang.String elementName, java.lang.Class<?> upperType, XmlMappingMetaData[] configuration, java.lang.String id)
Convenience constructor for creating the root/item mapping configuration.XmlMappingMetaData(XmlMappingType type, java.lang.String getMethodName, java.lang.String id)
Convenience constructor for creating a reference mapping.XmlMappingMetaData(XmlMappingType type, java.lang.String tagName, java.lang.String getMethodName, boolean isUseRaw)
Convenience constructor for creating an attribute/value mapping.XmlMappingMetaData(XmlMappingType type, java.lang.String elementName, java.lang.String getMethodName, XmlMappingMetaData[] objectMappings, java.lang.String id)
Convenience constructor for creating a collection/object mapping.XmlMappingMetaData(XmlMappingType type, XmlMappingMetaData[] attributes)
Convenience constructor for creating attributes mapping.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObjectMapping(XmlMappingMetaData mapping)
Adds aXmlMappingMetaData
for the object in the current context.java.lang.String
getAttributeName()
Obtains the attribute name.java.lang.String
getElementName()
Obtains the elemenet name.java.lang.String
getGetMethodName()
Obtains the name of the method to get the value from the object in the current context.java.lang.String
getId()
Obtains the Id for reference mapping.XmlMappingMetaData[]
getObjectMappings()
Obtains the meta-data of the mappings for the object in the current context.java.lang.String
getStaticValue()
Obtains the static value for the element/attribute.XmlMappingType
getType()
Obtains the type of this XML mapping.java.lang.String
getUpperBoundType()
Obtains the class name of the upper bound type of the current object in the context.boolean
isUseRaw()
Indicates whether the value should be used raw or whether it should be transformed for XML (ie special characters substituted).protected void
loadObjectMappings(XmlMappingMetaData[] objectMappings)
Loads the object mappings.void
setAttributeName(java.lang.String attributeName)
Specifies the attribute name.void
setElementName(java.lang.String elementName)
Specifies the element name.void
setGetMethodName(java.lang.String getMethodName)
Specifies the name of the method to get the value from the object in the current context.void
setId(java.lang.String id)
Specifies the Id for reference mapping.void
setIsUseRaw(java.lang.String isUseRaw)
Specifies whether the value should be used raw or whether it should be transformed for XML (ie special characters subsituted).void
setType(java.lang.String type)
Specifies the type of this XML mapping.void
setUpperBoundType(java.lang.String type)
Specifies the class name of the upper bound type of the current object in the context.
-
-
-
Field Detail
-
upperBoundType
protected java.lang.String upperBoundType
Upper bound type of the object that this mapping is sourcing from.
-
elementName
protected java.lang.String elementName
Element name for this mapping.
-
attributeName
protected java.lang.String attributeName
Attribute name flagging this mapping, if set, to be an attribute.
-
getMethodName
protected java.lang.String getMethodName
Name of method to object the value/object for this mapping.
-
staticValue
protected java.lang.String staticValue
Static value for the mapping.
-
isUseRaw
protected boolean isUseRaw
Indicates if to use the value raw.
-
objectMappings
protected java.util.List<XmlMappingMetaData> objectMappings
The mappings of the object in current context.
-
type
protected XmlMappingType type
Type of this Xml Mapping.
-
id
protected java.lang.String id
Id for referencing.
-
-
Constructor Detail
-
XmlMappingMetaData
public XmlMappingMetaData()
Default constructor to allow theTreeXmlUnmarshaller
to configure this.
-
XmlMappingMetaData
public XmlMappingMetaData(XmlMappingType type, java.lang.String elementName, java.lang.Class<?> upperType, XmlMappingMetaData[] configuration, java.lang.String id)
Convenience constructor for creating the root/item mapping configuration.- Parameters:
type
- EitherXmlMappingType.ROOT
orXmlMappingType.ITEM
.elementName
- Name of root element.upperType
- Upper bound type of root object.configuration
- Configuration of the root object.id
- Id to reference. May benull
if not referenced.
-
XmlMappingMetaData
public XmlMappingMetaData(XmlMappingType type, XmlMappingMetaData[] attributes)
Convenience constructor for creating attributes mapping.- Parameters:
type
-XmlMappingType.ATTRIBUTES
.attributes
- Mapping for the attributes of element.
-
XmlMappingMetaData
public XmlMappingMetaData(XmlMappingType type, java.lang.String tagName, java.lang.String getMethodName, boolean isUseRaw)
Convenience constructor for creating an attribute/value mapping.- Parameters:
type
- EitherXmlMappingType.ATTRIBUTE
orXmlMappingType.VALUE
.tagName
- Name of the attribute/element.getMethodName
- Method to obtain the value.isUseRaw
- Indicates if use the raw value from object.
-
XmlMappingMetaData
public XmlMappingMetaData(XmlMappingType type, java.lang.String elementName, java.lang.String getMethodName, XmlMappingMetaData[] objectMappings, java.lang.String id)
Convenience constructor for creating a collection/object mapping.- Parameters:
type
- EitherXmlMappingType.COLLECTION
,XmlMappingType.TYPE
orXmlMappingType.OBJECT
.elementName
- Name of element for context.getMethodName
- Method to obtain object.objectMappings
- Configuration of the mappings for the object.id
- Id for referencing this.
-
XmlMappingMetaData
public XmlMappingMetaData(XmlMappingType type, java.lang.String getMethodName, java.lang.String id)
Convenience constructor for creating a reference mapping.- Parameters:
type
-XmlMappingType.REFERENCE
.getMethodName
- Method to obtain object.id
- Id of mapping to handle object.
-
-
Method Detail
-
getElementName
public java.lang.String getElementName()
Obtains the elemenet name.- Returns:
- Name for the element.
-
setElementName
public void setElementName(java.lang.String elementName)
Specifies the element name.- Parameters:
elementName
- Name for the element.
-
getAttributeName
public java.lang.String getAttributeName()
Obtains the attribute name.- Returns:
- Name for the attribute.
-
setAttributeName
public void setAttributeName(java.lang.String attributeName)
Specifies the attribute name.- Parameters:
attributeName
- Name for the attribute.
-
getObjectMappings
public XmlMappingMetaData[] getObjectMappings()
Obtains the meta-data of the mappings for the object in the current context.- Returns:
- Meta-data of the mappings for the object in the current context.
-
addObjectMapping
public void addObjectMapping(XmlMappingMetaData mapping)
Adds aXmlMappingMetaData
for the object in the current context.- Parameters:
mapping
- Meta-data mapping for object in current context.
-
getUpperBoundType
public java.lang.String getUpperBoundType()
Obtains the class name of the upper bound type of the current object in the context.- Returns:
- Upper bound type of the current object in the context.
-
setUpperBoundType
public void setUpperBoundType(java.lang.String type)
Specifies the class name of the upper bound type of the current object in the context.- Parameters:
type
- Upper bound type of the current object in the context.
-
getGetMethodName
public java.lang.String getGetMethodName()
Obtains the name of the method to get the value from the object in the current context.- Returns:
- Name of method.
-
setGetMethodName
public void setGetMethodName(java.lang.String getMethodName)
Specifies the name of the method to get the value from the object in the current context.- Parameters:
getMethodName
- Name of method.
-
getStaticValue
public java.lang.String getStaticValue()
Obtains the static value for the element/attribute.- Returns:
- Static value for the element/attribute.
-
isUseRaw
public boolean isUseRaw()
Indicates whether the value should be used raw or whether it should be transformed for XML (ie special characters substituted).- Returns:
- Flag indicate whether to use the raw value.
-
setIsUseRaw
public void setIsUseRaw(java.lang.String isUseRaw)
Specifies whether the value should be used raw or whether it should be transformed for XML (ie special characters subsituted).- Parameters:
isUseRaw
- Flag indicating whether to use the raw value.
-
getType
public XmlMappingType getType()
Obtains the type of this XML mapping.- Returns:
- Type of this XML mapping.
-
setType
public void setType(java.lang.String type)
Specifies the type of this XML mapping.- Parameters:
type
- Type for this XML mapping.
-
getId
public java.lang.String getId()
Obtains the Id for reference mapping.- Returns:
- Id for referencing.
-
setId
public void setId(java.lang.String id)
Specifies the Id for reference mapping.- Parameters:
id
- Id for referencing.
-
loadObjectMappings
protected void loadObjectMappings(XmlMappingMetaData[] objectMappings)
Loads the object mappings.- Parameters:
objectMappings
- Object mappings.
-
-