public class XMLFieldDescriptorImpl extends AbstractFieldDescriptor 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 and Description |
|---|---|
boolean |
_isReference
True if the field is a reference to another Object in the hierarchy.
|
PROPERTY_XML_LANG, PROPERTY_XML_SPACE| Constructor and 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 and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Returns true if two XMLFieldDescriptors should be treated as
equal.
|
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 marshalling
as XML.
|
java.lang.String |
getNameSpaceURI()
Returns the namespace URI to be used when marshalling and
unmarshalling as XML.
|
NodeType |
getNodeType()
Returns the NodeType of the Field being described.
|
java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value property with the given name or null
if no such property exists.
|
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.
|
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.
|
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 |
isIncremental()
Returns the incremental flag which when true indicates that this
member may be safely added before the unmarshaller is finished
unmarshalling 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 |
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 |
setIncremental(boolean incremental)
Sets the incremental flag which indicates whether this member
can be added before the unmarshaller is finished unmarshalling 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 marshalling as XML.
|
void |
setNameSpaceURI(java.lang.String nsURI)
Sets the namespace URI used when marshalling and unmarshalling 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 |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value property with the given name.
|
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 |
setUseParentsNamespace(boolean useParentsNamespace)
Sets whether or not the namespace for the parent "containing"
class should be used during marshalling/unmarshalling 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.
|
java.lang.String |
toString() |
getClassDescriptor, getContainingClassDescriptor, getFieldName, getFieldType, getHandler, isImmutable, isMultivalued, isRequired, isTransient, setClassDescriptor, setContainingClassDescriptor, setFieldName, setFieldType, setHandler, setImmutable, setMultivalued, setRequired, setTransientclone, finalize, getClass, notify, notifyAll, wait, wait, waitisMultivaluedgetClassDescriptor, getContainingClassDescriptor, getFieldName, getFieldType, getHandler, isImmutable, isRequired, isTransient, setContainingClassDescriptorpublic 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 fieldMappingException - Invalid mapping informationpublic void setConstructorArgumentIndex(int index)
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()
XMLFieldDescriptorgetConstructorArgumentIndex in interface XMLFieldDescriptor{@inheritDoc}public boolean isConstructorArgument()
XMLFieldDescriptorisConstructorArgument in interface XMLFieldDescriptor{@inheritDoc}public void setLocationPath(java.lang.String path)
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
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{@inheritDoc}public void setNameSpacePrefix(java.lang.String nsPrefix)
nsPrefix - The namespace prefix used when marshalling the "described" object.public java.lang.String getNameSpacePrefix()
XMLFieldDescriptorgetNameSpacePrefix in interface XMLFieldDescriptor{@inheritDoc}public void setUseParentsNamespace(boolean useParentsNamespace)
public void setNameSpaceURI(java.lang.String nsURI)
nsURI - The namespace URI used when marshalling and unmarshalling the
"described" Object.public java.lang.String getNameSpaceURI()
XMLFieldDescriptorgetNameSpaceURI in interface XMLFieldDescriptor{@inheritDoc}public void setNodeType(NodeType nodeType)
nodeType - the NodeType for the described field.public NodeType getNodeType()
XMLFieldDescriptorgetNodeType in interface XMLFieldDescriptor{@inheritDoc}public void setProperty(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.getProperty(java.lang.String)public java.lang.String getProperty(java.lang.String propertyName)
XMLFieldDescriptorgetProperty in interface XMLFieldDescriptorpropertyName - the name of the property whose value
should be returned.{@inheritDoc}public void setSchemaType(java.lang.String schemaType)
schemaType - The value type.public java.lang.String getSchemaType()
XMLFieldDescriptorgetSchemaType in interface XMLFieldDescriptor{@inheritDoc}public void setValidator(FieldValidator validator)
public FieldValidator getValidator()
XMLFieldDescriptorgetValidator in interface XMLFieldDescriptor{@inheritDoc}public void setXMLName(java.lang.String xmlName)
xmlName - the XML name for the described field.public java.lang.String getXMLName()
XMLFieldDescriptorgetXMLName in interface XMLFieldDescriptor{@inheritDoc}public void setContainer(boolean isContainer)
isContainer - a boolean indicating whether or not the field is a container
field.public boolean isContainer()
XMLFieldDescriptorisContainer in interface XMLFieldDescriptor{@inheritDoc}public void setIncremental(boolean incremental)
incremental - the boolean which if true indicated that this
member can safely be added before the unmarshaller is finished
unmarshalling it.public boolean isIncremental()
XMLFieldDescriptorisIncremental in interface XMLFieldDescriptor{@inheritDoc}public void setMapped(boolean mapped)
mapped - a boolean that when true indicates this field is a Hashtable or Map.public boolean isMapped()
XMLFieldDescriptorisMapped in interface XMLFieldDescriptor{@inheritDoc}public void setNillable(boolean nillable)
nillable - a boolean indicating whether or not the described field may be
nillable.public boolean isNillable()
XMLFieldDescriptorisNillable in interface XMLFieldDescriptor{@inheritDoc}public void setReference(boolean isReference)
isReference - true if the field is a reference to another field.public boolean isReference()
XMLFieldDescriptorisReference in interface XMLFieldDescriptor{@inheritDoc}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)
XMLFieldDescriptormatches in interface XMLFieldDescriptorxmlName - the XML name to compare{@inheritDoc}public boolean matches(java.lang.String xmlName,
java.lang.String namespace)
XMLFieldDescriptormatches in interface XMLFieldDescriptorxmlName - the XML name to comparenamespace - the namespace URI{@inheritDoc}public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.ObjectIntalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com