|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.util.XMLFieldDescriptorImpl
public class XMLFieldDescriptorImpl
XML field descriptor. Wraps FieldDescriptor
and adds
XML-related information, type conversion, etc.
Field Summary | |
---|---|
boolean |
_isReference
True if the field is a reference to another Object in the hierarchy. |
boolean |
_required
indicates a required field when true |
Fields inherited from interface org.exolab.castor.xml.XMLFieldDescriptor |
---|
PROPERTY_XML_LANG, PROPERTY_XML_SPACE |
Constructor Summary | |
---|---|
XMLFieldDescriptorImpl(java.lang.Class fieldType,
java.lang.String fieldName,
java.lang.String xmlName,
NodeType nodeType)
|
|
XMLFieldDescriptorImpl(FieldDescriptor fieldDesc,
java.lang.String xmlName,
NodeType nodeType)
Construct a new field descriptor for the specified field. |
|
XMLFieldDescriptorImpl(FieldDescriptor fieldDesc,
java.lang.String xmlName,
NodeType nodeType,
NodeType primitiveNodeType)
Construct a new field descriptor for the specified field. |
|
XMLFieldDescriptorImpl(XMLFieldDescriptor fieldDesc)
Makes a new copy of the given XMLFieldDescriptorImpl |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Returns true if two XMLFieldDescriptors should be treated as equal. |
ClassDescriptor |
getClassDescriptor()
Returns the class descriptor related to the field type. |
CollectionHandler |
getCollectionHandler()
Return the collection handler of this field type. |
int |
getConstructorArgumentIndex()
Returns the index within the constructor argument array where the value of this field should be. |
ClassDescriptor |
getContainingClassDescriptor()
|
java.lang.String |
getFieldName()
Returns the name of the field. |
java.lang.Class |
getFieldType()
Returns the Java type of the field. |
FieldHandler |
getHandler()
Returns the handler of the field. |
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 value of the field described by this descriptor. |
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 |
protected boolean |
hasNonDefaultMatching()
Returns true if a call to #setMatches has been made with a non-null, or non-zero-length value. |
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 |
isImmutable()
Returns true if the field type is immutable. |
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 |
isMultivalued()
Returns true if the Object described by this descriptor can contain more than one value |
boolean |
isNillable()
Returns true if the field described by this descriptor may be nillable. |
protected static boolean |
isPrimitive(java.lang.Class type)
Returns true if the given class should be treated as a primitive type. |
boolean |
isReference()
Returns true if the field described by this descriptor is a reference (ie. |
boolean |
isRequired()
Returns true if the field described by this descriptor is a required field |
boolean |
isTransient()
Returns true if the field is transient. |
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 |
setClassDescriptor(XMLClassDescriptor classDescriptor)
Sets the XMLClassDescriptor for the described field |
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 |
setContainingClassDescriptor(ClassDescriptor contClsDesc)
Set the class which contains this field |
void |
setHandler(FieldHandler handler)
Sets the FieldHandler for the field being described by this FieldDescriptor |
void |
setImmutable(boolean immutable)
Sets the immutable flag which indicates that changes to this Field result in a new Object to be created, such as java.lang.String. |
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 |
setMultivalued(boolean multivalued)
|
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 |
setRequired(boolean required)
Sets the whether or not the described field is required |
void |
setSchemaType(java.lang.String schemaType)
Sets the type of the XML Schema type of the value for the field being described. |
void |
setTransient(boolean isTransient)
Sets whether or not the describled field is transient |
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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public boolean _isReference
public boolean _required
Constructor Detail |
---|
public XMLFieldDescriptorImpl(java.lang.Class fieldType, java.lang.String fieldName, java.lang.String xmlName, NodeType nodeType)
public XMLFieldDescriptorImpl(XMLFieldDescriptor fieldDesc) throws MappingException
fieldDesc
- The XMLFieldDescriptor to copy
MappingException
- Invalid mapping informationpublic XMLFieldDescriptorImpl(FieldDescriptor fieldDesc, java.lang.String xmlName, NodeType nodeType) throws MappingException
fieldDesc
- The field descriptorxmlName
- The XML name of the fieldnodeType
- The node type of this field
MappingException
- Invalid mapping informationpublic 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 field
MappingException
- Invalid mapping informationMethod Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void setContainingClassDescriptor(ClassDescriptor contClsDesc)
setContainingClassDescriptor
in interface FieldDescriptor
public ClassDescriptor getContainingClassDescriptor()
getContainingClassDescriptor
in interface FieldDescriptor
public ClassDescriptor getClassDescriptor()
getClassDescriptor
in interface FieldDescriptor
public CollectionHandler getCollectionHandler()
public int getConstructorArgumentIndex()
getConstructorArgumentIndex
in interface XMLFieldDescriptor
isConstructorArgument
public java.lang.String getFieldName()
getFieldName
in interface FieldDescriptor
public java.lang.Class getFieldType()
getFieldType
in interface FieldDescriptor
public FieldHandler getHandler()
getHandler
in interface FieldDescriptor
public java.lang.String getXMLName()
getXMLName
in interface XMLFieldDescriptor
public java.lang.String getNameSpacePrefix()
getNameSpacePrefix
in interface XMLFieldDescriptor
public java.lang.String getNameSpaceURI()
getNameSpaceURI
in interface XMLFieldDescriptor
public NodeType getNodeType()
XMLFieldDescriptor
getNodeType
in interface XMLFieldDescriptor
public java.lang.String getLocationPath()
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
public java.lang.String getProperty(java.lang.String propertyName)
getProperty
in interface XMLFieldDescriptor
propertyName
- the name of the property whose value
should be returned.
public java.lang.String getQNamePrefix()
public FieldValidator getValidator()
getValidator
in interface XMLFieldDescriptor
public java.lang.String getSchemaType()
getSchemaType
in interface XMLFieldDescriptor
public boolean isConstructorArgument()
isConstructorArgument
in interface XMLFieldDescriptor
public boolean isContainer()
isContainer
in interface XMLFieldDescriptor
public boolean isImmutable()
isImmutable
in interface FieldDescriptor
public boolean isIncremental()
isIncremental
in interface XMLFieldDescriptor
public boolean isMapped()
isMapped
in interface XMLFieldDescriptor
public boolean isMultivalued()
isMultivalued
in interface FieldDescriptor
isMultivalued
in interface XMLFieldDescriptor
public boolean isNillable()
XMLFieldDescriptor
isNillable
in interface XMLFieldDescriptor
public boolean isReference()
isReference
in interface XMLFieldDescriptor
public boolean isRequired()
isRequired
in interface FieldDescriptor
public boolean isTransient()
isTransient
in interface FieldDescriptor
public void setContainer(boolean isContainer)
isContainer
- a boolean indicating whether or not the field
is a container field.public boolean matches(java.lang.String xmlName)
matches
in interface XMLFieldDescriptor
xmlName
- the XML name to compare
public boolean matches(java.lang.String xmlName, java.lang.String namespace)
matches
in interface XMLFieldDescriptor
xmlName
- the XML name to comparenamespace
- the namespace URI
public void setClassDescriptor(XMLClassDescriptor classDescriptor)
classDescriptor
- the XMLClassDescriptor for the described field.public 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 void setHandler(FieldHandler handler)
handler
- the FieldHandler for the field being described
by this FieldDescriptorpublic 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 void setImmutable(boolean immutable)
immutable
- the boolean which if true indicated that this
described field is immutablepublic 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 void setMapped(boolean mapped)
mapped
- a boolean that when true indicates this field is
a Hashtable or Map.public void setMatches(java.lang.String matchExpr)
matchExpr
- the space separated list of xml names, matched
by this descriptorpublic void setMultivalued(boolean multivalued)
public void setNillable(boolean nillable)
nillable
- a boolean indicating whether or not
the described field may be nillable.public void setProperty(java.lang.String propertyName, java.lang.String value)
propertyName
- the name of the property to set
the value ofvalue
- the value of the propertygetProperty
public void setSchemaType(java.lang.String schemaType)
type
- the value type.public void setQNamePrefix(java.lang.String qNamePrefix)
qNamePrefix
- public void setReference(boolean isReference)
isReference,
- true if the field is a reference to another field.public void setNameSpacePrefix(java.lang.String nsPrefix)
nsPrefix
- the namespace prefix used when marshalling
the "described" objectpublic void setNameSpaceURI(java.lang.String nsURI)
nsURI
- the namespace URI used when marshalling and
unmarshalling the "described" Object.public void setNodeType(NodeType nodeType)
nodeType
- the NodeType for the described fieldpublic void setRequired(boolean required)
required
- the flag indicating whether or not the
described field is requiredpublic void setTransient(boolean isTransient)
isTransient
- the flag indicating whether or not the
described field is "transient".isTransient()
public void setUseParentsNamespace(boolean useParentsNamespace)
public void setValidator(FieldValidator validator)
public void setXMLName(java.lang.String xmlName)
name
- the XML name for the described fieldpublic java.lang.String toString()
toString
in class java.lang.Object
protected boolean hasNonDefaultMatching()
protected static boolean isPrimitive(java.lang.Class type)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |