NatureExtendable
, PropertyHolder
, FieldDescriptor
, XMLFieldDescriptor
XMLContainerElementFieldDescriptor
public class XMLFieldDescriptorImpl extends FieldDescriptorImpl implements XMLFieldDescriptor
FieldDescriptor
and adds XML-related
information, type conversion, etc.
Note: When using a GeneralizedFieldHandler the getFieldType() methods of handler and descriptor need to return the same result.
Modifier and Type | Field | Description |
---|---|---|
boolean |
_isReference |
True if the field is a reference to another Object in the hierarchy.
|
PROPERTY_XML_LANG, PROPERTY_XML_SPACE
Constructor | Description |
---|---|
XMLFieldDescriptorImpl(java.lang.Class<?> fieldType,
java.lang.String fieldName,
java.lang.String xmlName,
NodeType nodeType) |
|
XMLFieldDescriptorImpl(FieldDescriptor fieldDesc,
java.lang.String xmlName,
NodeType nodeType,
NodeType primitiveNodeType) |
Construct a new field descriptor for the specified field.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object obj) |
Returns true if two XMLFieldDescriptors should be treated as equal.
|
java.lang.String |
getComponentType() |
Returns the component type of this
XMLFieldDescriptor instance, if
the field described represents a collection of values. |
int |
getConstructorArgumentIndex() |
Returns the index within the constructor argument array where the value
of this field should be.
|
java.lang.String |
getLocationPath() |
Returns the "relative" XML path for the field being described.
|
java.lang.String |
getNameSpacePrefix() |
Return the "suggested" namespace prefix to use when marshaling as XML.
|
java.lang.String |
getNameSpaceURI() |
Returns the namespace URI to be used when marshaling and unmarshaling as
XML.
|
NodeType |
getNodeType() |
Returns the node type of the field being described.
|
java.lang.String |
getQNamePrefix() |
Returns the prefix used in case the value of the field described by this
descriptor is of type QName.
|
java.lang.String |
getSchemaType() |
Returns the XML Schema type of the XML field being described.
|
java.util.List<java.lang.String> |
getSubstitutes() |
Returns the possible substitution groups for this class.
|
FieldValidator |
getValidator() |
Returns a specific validator for the field described by this descriptor.
|
java.lang.String |
getXMLName() |
Returns the XML Name for the field being described.
|
java.lang.String |
getXMLProperty(java.lang.String propertyName) |
Returns the value property with the given name or null if no such
property exists.
|
int |
hashCode() |
Returns the hashCode for this XMLFieldDescriptor
|
boolean |
isConstructorArgument() |
Returns true if the value of the field represented by this descriptor
should be set via the constructor of the containing class.
|
boolean |
isContainer() |
Returns true if the field described by this descriptor is a container
field.
|
boolean |
isDerivedFromXSList() |
Indicates whether the field described by this
XMLFieldDescriptorImpl is
created as a result of a |
boolean |
isIncremental() |
Returns the incremental flag which when true indicates that this member
may be safely added before the unmarshaler is finished unmarshaling it.
|
boolean |
isMapped() |
Returns true if the field described by this descriptor is Map or
Hashtable.
|
boolean |
isNillable() |
Returns true if the field described by this descriptor may be nillable.
|
boolean |
isReference() |
Returns true if the field described by this descriptor is a reference
(ie.
|
boolean |
matches(java.lang.String xmlName) |
Returns true if this descriptor can be used to handle elements or
attributes with the given XML name.
|
boolean |
matches(java.lang.String xmlName,
java.lang.String namespace) |
Returns true if this descriptor can be used to handle elements or
attributes with the given XML name.
|
void |
setComponentType(java.lang.String componentType) |
Sets the type of the XML Schema type of the value for the field being
described.
|
void |
setConstructorArgumentIndex(int index) |
Sets whether or not the value of the field represented by this
FieldDescriptor should be set via the constructor of the containing
ClassDescriptor.
|
void |
setContainer(boolean isContainer) |
Set if the field is a container field or not.
|
void |
setDerivedFromXSList(boolean derivedFromXSList) |
Sets whether the field described by this
XMLFieldDescriptorImpl is
created as a result of a |
void |
setIncremental(boolean incremental) |
Sets the incremental flag which indicates whether this member can be
added before the unmarshaler is finished unmarshaling it.
|
void |
setLocationPath(java.lang.String path) |
Sets the location path for the field being described.
|
void |
setMapped(boolean mapped) |
Sets whether or not this field has been mapped in a Map or Hashtable.
|
void |
setMatches(java.lang.String matchExpr) |
This is a space separated list of xml names that this Field descriptor
matches.
|
void |
setNameSpacePrefix(java.lang.String nsPrefix) |
Sets the namespace prefix used when marshaling as XML.
|
void |
setNameSpaceURI(java.lang.String nsURI) |
Sets the namespace URI used when marshaling and unmarshaling as XML.
|
void |
setNillable(boolean nillable) |
Sets whether or not the described field is allowed to be nil.
|
void |
setNodeType(NodeType nodeType) |
Sets the XML node type for the described field.
|
void |
setQNamePrefix(java.lang.String qNamePrefix) |
Sets the prefix used in case the value of the field described by this
descriptor is of type QName.
|
void |
setReference(boolean isReference) |
Sets the flag indicating that the field described by this descriptor is a
reference to another field in the object model.
|
void |
setSchemaType(java.lang.String schemaType) |
Sets the type of the XML Schema type of the value for the field being
described.
|
void |
setSubstitutes(java.util.List<java.lang.String> substitutes) |
Sets the possible substitution groups for this class.
|
void |
setUseParentsNamespace(boolean useParentsNamespace) |
Sets whether or not the namespace for the parent "containing" class
should be used during marshaling/unmarshaling when no specific
namespace URI has been set for this field.
|
void |
setValidator(FieldValidator validator) |
|
void |
setXMLName(java.lang.String xmlName) |
Sets the xml name for the described field.
|
void |
setXMLProperty(java.lang.String propertyName,
java.lang.String value) |
Sets the value property with the given name.
|
java.lang.String |
toString() |
getClassDescriptor, getContainingClassDescriptor, getFieldName, getFieldType, getHandler, isImmutable, isRequired, isTransient, setContainingClassDescriptor
addNature, getClassDescriptor, getCollection, getComparator, getContainingClassDescriptor, getCreateMethod, getFieldName, getFieldType, getGetMethod, getHandler, getProperty, getSetMethod, hasNature, isDirect, isIdentity, isImmutable, isLazy, isMultivalued, isRequired, isTransient, setClassDescriptor, setCollection, setComparator, setContainingClassDescriptor, setCreateMethod, setDirect, setFieldName, setFieldType, setGetMethod, setHandler, setIdentity, setImmutable, setLazy, setMultivalued, setProperty, setRequired, setSetMethod, setTransient
addNature, hasNature
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getProperty, setProperty
isMultivalued
public boolean _isReference
public XMLFieldDescriptorImpl(java.lang.Class<?> fieldType, java.lang.String fieldName, java.lang.String xmlName, NodeType nodeType)
public XMLFieldDescriptorImpl(FieldDescriptor fieldDesc, java.lang.String xmlName, NodeType nodeType, NodeType primitiveNodeType) throws MappingException
fieldDesc
- The field descriptorxmlName
- The XML name of the fieldnodeType
- The node type of this fieldprimitiveNodeType
- MappingException
- Invalid mapping informationpublic void setConstructorArgumentIndex(int index)
Note: This only applies to attribute mapped fields at this time.
index
- the index within the argument array. A value less than zero
indicates that this field should not be part of the constructor
arguments.public int getConstructorArgumentIndex()
XMLFieldDescriptor
Note: This only applies to attribute mapped fields at this time.
getConstructorArgumentIndex
in interface XMLFieldDescriptor
XMLFieldDescriptor.getConstructorArgumentIndex()
public boolean isConstructorArgument()
XMLFieldDescriptor
isConstructorArgument
in interface XMLFieldDescriptor
XMLFieldDescriptor.isConstructorArgument()
public void setLocationPath(java.lang.String path)
In most cases, this isn't needed. However sometimes a field may be mapped to a nested element. In which case the value of the location path should be the nested element name. If more than one level of nesting is needed each nested element name should be separated by a path separator (forward slash '/').
The location path name is "relative" to the parent Class. The name of the parent should not be included in the path.
For example, give the following two classes:
class Root {
Bar bar;
}
class Bar {
String value;
}
And the following XML:
<root>
<foo>
<bar> value of bar </bar>
</foo>
</root>
Since foo has no associated class, the path for 'bar' would be: "foo"
path
- the "relative" location path for the field.getLocationPath()
public java.lang.String getLocationPath()
XMLFieldDescriptor
In most cases, this will be null. However sometimes a field may be mapped to a nested element. In which case the value returned by this method should be the nested element name. If more than one level of nesting is needed each nested element name should be separated by by a path separator (forward slash '/').
The location path name is "relative" to the parent Class. The name of the parent must not be included in the path.
For example, give the following two classes:
class Root { Bar bar; } class Bar { String value; }And the following XML:
<root> <foo> <bar> value of bar </bar> </foo> </root>Since <foo> has no associated class, the path for 'bar' would be: "foo"
getLocationPath
in interface XMLFieldDescriptor
XMLFieldDescriptor.getLocationPath()
public void setNameSpacePrefix(java.lang.String nsPrefix)
nsPrefix
- The namespace prefix used when marshaling the
"described" object.public java.lang.String getNameSpacePrefix()
XMLFieldDescriptor
getNameSpacePrefix
in interface XMLFieldDescriptor
XMLFieldDescriptor.getNameSpacePrefix()
public void setUseParentsNamespace(boolean useParentsNamespace)
public void setNameSpaceURI(java.lang.String nsURI)
nsURI
- The namespace URI used when marshaling and unmarshaling the
"described" Object.public java.lang.String getNameSpaceURI()
XMLFieldDescriptor
getNameSpaceURI
in interface XMLFieldDescriptor
XMLFieldDescriptor.getNameSpaceURI()
public void setNodeType(NodeType nodeType)
nodeType
- the NodeType for the described field.public NodeType getNodeType()
XMLFieldDescriptor
NodeType
represents the type of node that the field will be marshaled into XML as.getNodeType
in interface XMLFieldDescriptor
NodeType
of the Field being described.XMLFieldDescriptor.getNodeType()
public void setXMLProperty(java.lang.String propertyName, java.lang.String value)
propertyName
- The name of the property to set the value of.value
- The value of the property.FieldDescriptorImpl.getProperty(java.lang.String)
public java.lang.String getXMLProperty(java.lang.String propertyName)
XMLFieldDescriptor
getXMLProperty
in interface XMLFieldDescriptor
propertyName
- the name of the property whose value should be
returned.PropertyHolder.getProperty(java.lang.String)
public void setSchemaType(java.lang.String schemaType)
schemaType
- The value type.public void setComponentType(java.lang.String componentType)
componentType
- The component type for <xs:list>s.public java.lang.String getSchemaType()
XMLFieldDescriptor
getSchemaType
in interface XMLFieldDescriptor
XMLFieldDescriptor.getSchemaType()
public java.lang.String getComponentType()
XMLFieldDescriptor
instance, if
the field described represents a collection of values.getComponentType
in interface XMLFieldDescriptor
XMLFieldDescriptor.getComponentType()
public void setValidator(FieldValidator validator)
public FieldValidator getValidator()
XMLFieldDescriptor
getValidator
in interface XMLFieldDescriptor
XMLFieldDescriptor.getValidator()
public void setXMLName(java.lang.String xmlName)
xmlName
- the XML name for the described field.public java.lang.String getXMLName()
XMLFieldDescriptor
getXMLName
in interface XMLFieldDescriptor
XMLFieldDescriptor.getXMLName()
public void setContainer(boolean isContainer)
isContainer
- a boolean indicating whether or not the field is a
container field.public boolean isContainer()
XMLFieldDescriptor
isContainer
in interface XMLFieldDescriptor
XMLFieldDescriptor.isContainer()
public void setIncremental(boolean incremental)
incremental
- the boolean which if true indicated that this member
can safely be added before the unmarshaler is finished
unmarshaling it.public boolean isIncremental()
XMLFieldDescriptor
isIncremental
in interface XMLFieldDescriptor
XMLFieldDescriptor.isIncremental()
public void setMapped(boolean mapped)
mapped
- a boolean that when true indicates this field is a
Hashtable or Map.public boolean isMapped()
XMLFieldDescriptor
XMLFieldDescriptor.isMultivalued()
.isMapped
in interface XMLFieldDescriptor
XMLFieldDescriptor.isMapped()
public void setNillable(boolean nillable)
nillable
- a boolean indicating whether or not the described field
may be nillable.public boolean isNillable()
XMLFieldDescriptor
isNillable
in interface XMLFieldDescriptor
XMLFieldDescriptor.isNillable()
public void setReference(boolean isReference)
isReference
- true if the field is a reference to another field.public boolean isReference()
XMLFieldDescriptor
isReference
in interface XMLFieldDescriptor
XMLFieldDescriptor.isReference()
public void setQNamePrefix(java.lang.String qNamePrefix)
qNamePrefix
- public java.lang.String getQNamePrefix()
public void setMatches(java.lang.String matchExpr)
matchExpr
- the space separated list of xml names, matched by this
descriptor.public boolean matches(java.lang.String xmlName)
XMLFieldDescriptor
matches
in interface XMLFieldDescriptor
xmlName
- the XML name to compareXMLFieldDescriptor.matches(java.lang.String)
public boolean matches(java.lang.String xmlName, java.lang.String namespace)
XMLFieldDescriptor
matches
in interface XMLFieldDescriptor
xmlName
- the XML name to comparenamespace
- the namespace URIXMLFieldDescriptor.matches(java.lang.String, java.lang.String)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare to this
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class FieldDescriptorImpl
public java.util.List<java.lang.String> getSubstitutes()
getSubstitutes
in interface XMLFieldDescriptor
public void setSubstitutes(java.util.List<java.lang.String> substitutes)
setSubstitutes
in interface XMLFieldDescriptor
substitutes
- Possible substitution groups for this class.public void setDerivedFromXSList(boolean derivedFromXSList)
XMLFieldDescriptorImpl
is
created as a result of a setDerivedFromXSList
in interface XMLFieldDescriptor
derivedFromXSList
- A boolean value, true or false.XMLFieldDescriptor.setDerivedFromXSList(boolean)
public boolean isDerivedFromXSList()
XMLFieldDescriptorImpl
is
created as a result of a isDerivedFromXSList
in interface XMLFieldDescriptor
XMLFieldDescriptor.isDerivedFromXSList()
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com