|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.xml.Validator
org.exolab.castor.xml.util.XMLClassDescriptorImpl
public class XMLClassDescriptorImpl
The core implementation of XMLClassDescriptor. This class is used by both generated source code as well as the XMLMappingLoader.
Constructor Summary | |
---|---|
protected |
XMLClassDescriptorImpl()
Protected constructor used by this class, and subclasses only |
|
XMLClassDescriptorImpl(java.lang.Class type)
Creates an XMLClassDescriptor class used by the Marshalling Framework. |
|
XMLClassDescriptorImpl(java.lang.Class type,
java.lang.String xmlName)
Creates an XMLClassDescriptor class used by the Marshalling Framework. |
Method Summary | |
---|---|
void |
addFieldDescriptor(XMLFieldDescriptor descriptor)
Adds the given XMLFieldDescriptor to the list of descriptors. |
boolean |
canAccept(java.lang.String name,
java.lang.String namespace,
java.lang.Object object)
Returns true if the given object, represented by this XMLClassDescriptor, can accept a value for the member associated with the given xml name and namespace. |
boolean |
contains(XMLFieldDescriptor descriptor)
Returns true if the given XMLFieldDescriptor is contained within this XMLClassDescriptor. |
AccessMode |
getAccessMode()
Returns the access mode specified for this class. |
XMLFieldDescriptor[] |
getAttributeDescriptors()
Returns the set of XMLFieldDescriptors for all members that should be marshalled as XML attributes. |
XMLFieldDescriptor |
getContentDescriptor()
Returns the XMLFieldDescriptor for the member that should be marshalled as text content. |
XMLFieldDescriptor[] |
getElementDescriptors()
Returns the set of XMLFieldDescriptors for all members that should be marshalled as XML elements. |
ClassDescriptor |
getExtends()
Returns the class descriptor of the class extended by this class. |
XMLFieldDescriptor |
getFieldDescriptor(java.lang.String name,
java.lang.String namespace,
NodeType nodeType)
Returns the XML field descriptor matching the given xml name and nodeType. |
FieldDescriptor[] |
getFields()
Returns a list of fields represented by this descriptor. |
FieldDescriptor |
getIdentity()
Returns the identity field, null if this class has no identity. |
java.lang.Class |
getJavaClass()
Returns the Java class represented by this descriptor. |
java.lang.String |
getNameSpacePrefix()
Returns the namespace prefix to use when marshalling as XML. |
java.lang.String |
getNameSpaceURI()
Returns the namespace URI used when marshalling and unmarshalling as XML. |
TypeValidator |
getValidator()
Returns a specific validator for the class described by this ClassDescriptor. |
java.lang.String |
getXMLName()
Returns the XML Name for the Class being described. |
boolean |
hasContainerFields()
Returns true if this XMLClassDescriptorImpl has any fields which are container objects. |
(package private) static boolean |
isDefaultPrimitiveValue(java.lang.Object value)
Checks to see if the given Object is a java primitive (does not check for primitive wrappers) and has a value that is equal to the default value for that primitive. |
(package private) static boolean |
isPrimitive(java.lang.Class type)
Returns true if the given class should be treated as a primitive type. |
boolean |
removeFieldDescriptor(XMLFieldDescriptor descriptor)
Removes the given XMLFieldDescriptor from the list of descriptors. |
void |
setCompositorAsAll()
Sets the compositor for the fields of the described class to be ALL. |
void |
setCompositorAsChoice()
Sets the compositor for the fields of the described class to be CHOICE. |
void |
setCompositorAsSequence()
Sets the compositor for the fields of the described class to be a Sequence. |
void |
setExtends(XMLClassDescriptor classDesc)
Sets the XMLClassDescriptor that this descriptor inherits from |
protected void |
setExtendsWithoutFlatten(XMLClassDescriptor classDesc)
|
void |
setIdentity(XMLFieldDescriptor fieldDesc)
Sets the Identity FieldDescriptor, if the FieldDescriptor is not already a contained in this ClassDescriptor, it will be added |
protected void |
setIntrospected(boolean introspected)
Sets a flag to indicate whether or not this XMLClassDescriptorImpl was created via introspection |
protected void |
setJavaClass(java.lang.Class type)
Sets the Class type being described by this descriptor. |
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 |
setXMLName(java.lang.String xmlName)
Sets the XML name for the Class described by this XMLClassDescriptor |
void |
sortDescriptors()
This method is used to keep the set of descriptors in the proper sorted lists. |
java.lang.String |
toString()
Returns the String representation of this XMLClassDescriptor |
protected java.lang.String |
toXMLName(java.lang.String className)
|
void |
validate(java.lang.Object object)
Validates the given Object |
void |
validate(java.lang.Object object,
ValidationContext context)
Validates the given object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XMLClassDescriptorImpl(java.lang.Class type)
type
- the Class type with which this ClassDescriptor describes.public XMLClassDescriptorImpl(java.lang.Class type, java.lang.String xmlName)
type
- the Class type with which this ClassDescriptor describes.protected XMLClassDescriptorImpl()
Method Detail |
---|
public void addFieldDescriptor(XMLFieldDescriptor descriptor)
descriptor
- the XMLFieldDescriptor to addpublic boolean contains(XMLFieldDescriptor descriptor)
public XMLFieldDescriptor[] getAttributeDescriptors()
getAttributeDescriptors
in interface XMLClassDescriptor
public XMLFieldDescriptor getContentDescriptor()
getContentDescriptor
in interface XMLClassDescriptor
public XMLFieldDescriptor[] getElementDescriptors()
getElementDescriptors
in interface XMLClassDescriptor
public XMLFieldDescriptor getFieldDescriptor(java.lang.String name, java.lang.String namespace, NodeType nodeType)
getFieldDescriptor
in interface XMLClassDescriptor
name
- the xml name to match againstnodeType,
- the NodeType to match against, or null if
the node type is not known.
public java.lang.String getNameSpacePrefix()
XMLClassDescriptor
getNameSpacePrefix
in interface XMLClassDescriptor
public java.lang.String getNameSpaceURI()
XMLClassDescriptor
getNameSpaceURI
in interface XMLClassDescriptor
public TypeValidator getValidator()
getValidator
in interface XMLClassDescriptor
public java.lang.String getXMLName()
getXMLName
in interface XMLClassDescriptor
public boolean hasContainerFields()
public boolean removeFieldDescriptor(XMLFieldDescriptor descriptor)
descriptor
- the XMLFieldDescriptor to removepublic void setCompositorAsAll()
public void setCompositorAsChoice()
public void setCompositorAsSequence()
public void setExtends(XMLClassDescriptor classDesc)
classDesc
- the XMLClassDescriptor that this descriptor
extendspublic void setIdentity(XMLFieldDescriptor fieldDesc)
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 setXMLName(java.lang.String xmlName)
xmlName
- the XML name for the Class described by this
XMLClassDescriptorpublic void sortDescriptors()
public java.lang.String toString()
toString
in class java.lang.Object
public void validate(java.lang.Object object) throws ValidationException
validate
in class Validator
object
- the Object to validate
ValidationException
public void validate(java.lang.Object object, ValidationContext context) throws ValidationException
validate
in interface ClassValidator
validate
in interface TypeValidator
validate
in class Validator
object
- the Object to validatecontext
- the ValidationContext
ValidationException
- when the class is not valid.public java.lang.Class getJavaClass()
getJavaClass
in interface ClassDescriptor
public FieldDescriptor[] getFields()
getFields
in interface ClassDescriptor
public ClassDescriptor getExtends()
getExtends
in interface ClassDescriptor
public FieldDescriptor getIdentity()
getIdentity
in interface ClassDescriptor
public AccessMode getAccessMode()
getAccessMode
in interface ClassDescriptor
public boolean canAccept(java.lang.String name, java.lang.String namespace, java.lang.Object object)
XMLClassDescriptor
Returns true if the given object, represented by this XMLClassDescriptor, can accept a value for the member associated with the given xml name and namespace.
An XMLClassDescriptor can accept a value for a field if it contains a descriptor that matches the given xml name and namespace and if the given object can hold this field (i.e a value is not already set for this field).
canAccept
in interface XMLClassDescriptor
name
- the xml name of the field to checknamespace
- the namespace uriobject
- the object instance represented by this XMLCLassDescriptor
static boolean isPrimitive(java.lang.Class type)
static boolean isDefaultPrimitiveValue(java.lang.Object value)
protected void setJavaClass(java.lang.Class type)
protected void setExtendsWithoutFlatten(XMLClassDescriptor classDesc)
protected void setIntrospected(boolean introspected)
introspected
- a boolean, when true indicated that this
XMLClassDescriptor was created via introspectionprotected java.lang.String toXMLName(java.lang.String className)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |