|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exolab.castor.xml.util.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 |
| 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 |
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. |
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 |
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 |
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 |
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 |
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, hashCode, 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 information
public 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 information
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 field
MappingException - Invalid mapping information| Method Detail |
public boolean equals(java.lang.Object obj)
public void setContainingClassDescriptor(ClassDescriptor contClsDesc)
setContainingClassDescriptor in interface FieldDescriptorpublic ClassDescriptor getContainingClassDescriptor()
getContainingClassDescriptor in interface FieldDescriptorpublic ClassDescriptor getClassDescriptor()
getClassDescriptor in interface FieldDescriptorpublic CollectionHandler getCollectionHandler()
public int getConstructorArgumentIndex()
getConstructorArgumentIndex in interface XMLFieldDescriptorisConstructorArgumentpublic java.lang.String getFieldName()
getFieldName in interface FieldDescriptorpublic java.lang.Class getFieldType()
getFieldType in interface FieldDescriptorpublic FieldHandler getHandler()
getHandler in interface FieldDescriptorpublic java.lang.String getXMLName()
getXMLName in interface XMLFieldDescriptorpublic java.lang.String getNameSpacePrefix()
getNameSpacePrefix in interface XMLFieldDescriptorpublic java.lang.String getNameSpaceURI()
getNameSpaceURI in interface XMLFieldDescriptorpublic NodeType getNodeType()
XMLFieldDescriptor
getNodeType in interface XMLFieldDescriptorpublic 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 XMLFieldDescriptorpublic java.lang.String getQNamePrefix()
public FieldValidator getValidator()
getValidator in interface XMLFieldDescriptorpublic java.lang.String getSchemaType()
getSchemaType in interface XMLFieldDescriptorpublic boolean isConstructorArgument()
isConstructorArgument in interface XMLFieldDescriptorpublic boolean isContainer()
isContainer in interface XMLFieldDescriptorpublic boolean isImmutable()
isImmutable in interface FieldDescriptorpublic boolean isIncremental()
isIncremental in interface XMLFieldDescriptorpublic boolean isMapped()
isMapped in interface XMLFieldDescriptorpublic boolean isMultivalued()
isMultivalued in interface XMLFieldDescriptorpublic boolean isReference()
isReference in interface XMLFieldDescriptorpublic boolean isRequired()
isRequired in interface FieldDescriptorpublic boolean isTransient()
isTransient in interface FieldDescriptorpublic 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 XMLFieldDescriptorxmlName - the XML name to compare
public boolean matches(java.lang.String xmlName,
java.lang.String namespace)
matches in interface XMLFieldDescriptorxmlName - 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 setSchemaType(java.lang.String schemaType)
public void setQNamePrefix(java.lang.String qNamePrefix)
qNamePrefix - public void setReference(boolean isReference)
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 setValidator(FieldValidator validator)
public void setXMLName(java.lang.String xmlName)
public java.lang.String toString()
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 | |||||||||