public class XMLClassDescriptorImpl extends Validator implements XMLClassDescriptor
| Modifier | Constructor and Description |
|---|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
boolean |
isElementDefinition()
Returns true if XML schema definition of this Class is that of a global
element or element with anonymous type definition.
|
(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 |
setElementDefinition(boolean elementDefinition)
Set elementDefinition to true to indicate Class XML schema
definition is a global element or element with anonymous type.
|
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
|
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()
public void addFieldDescriptor(XMLFieldDescriptor descriptor)
descriptor - the XMLFieldDescriptor to addpublic boolean contains(XMLFieldDescriptor descriptor)
public XMLFieldDescriptor[] getAttributeDescriptors()
getAttributeDescriptors in interface XMLClassDescriptorpublic XMLFieldDescriptor getContentDescriptor()
getContentDescriptor in interface XMLClassDescriptorpublic XMLFieldDescriptor[] getElementDescriptors()
getElementDescriptors in interface XMLClassDescriptorpublic XMLFieldDescriptor getFieldDescriptor(java.lang.String name, java.lang.String namespace, NodeType nodeType)
getFieldDescriptor in interface XMLClassDescriptorname - 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()
XMLClassDescriptorgetNameSpacePrefix in interface XMLClassDescriptorpublic java.lang.String getNameSpaceURI()
XMLClassDescriptorgetNameSpaceURI in interface XMLClassDescriptorpublic TypeValidator getValidator()
getValidator in interface XMLClassDescriptorpublic java.lang.String getXMLName()
getXMLName in interface XMLClassDescriptorpublic boolean isElementDefinition()
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 setElementDefinition(boolean elementDefinition)
elementDefinition - flag to indicate XML definition is
global element or element with anonymous typepublic void sortDescriptors()
public java.lang.String toString()
toString in class java.lang.Objectpublic void validate(java.lang.Object object)
throws ValidationException
validate in class Validatorobject - the Object to validateValidationExceptionpublic void validate(java.lang.Object object,
ValidationContext context)
throws ValidationException
validate in interface ClassValidatorvalidate in interface TypeValidatorvalidate in class Validatorobject - the Object to validatecontext - the ValidationContextValidationException - when the class is not valid.public java.lang.Class getJavaClass()
getJavaClass in interface ClassDescriptorpublic FieldDescriptor[] getFields()
getFields in interface ClassDescriptorpublic ClassDescriptor getExtends()
getExtends in interface ClassDescriptorpublic FieldDescriptor getIdentity()
getIdentity in interface ClassDescriptorpublic AccessMode getAccessMode()
getAccessMode in interface ClassDescriptorpublic boolean canAccept(java.lang.String name,
java.lang.String namespace,
java.lang.Object object)
XMLClassDescriptorReturns 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 XMLClassDescriptorname - the xml name of the field to checknamespace - the namespace uriobject - the object instance represented by this XMLCLassDescriptorXMLClassDescriptor.canAccept(java.lang.String,
java.lang.String, java.lang.Object)static boolean isPrimitive(java.lang.Class type)
static boolean isDefaultPrimitiveValue(java.lang.Object value)
protected void setJavaClass(java.lang.Class type)
type - the Class type being describedprotected 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)
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com