public class XMLClassDescriptorImpl extends Validator implements XMLClassDescriptor
resourceBundle| Modifier | Constructor and Description |
|---|---|
protected |
XMLClassDescriptorImpl()
Protected constructor used by this class, and subclasses only
|
|
XMLClassDescriptorImpl(Class<?> type)
Creates an XMLClassDescriptor class used by the Marshalling Framework.
|
|
XMLClassDescriptorImpl(Class<?> type,
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.
|
void |
addNature(String nature) |
protected void |
addSequenceElement(XMLFieldDescriptor element)
Adds a XMLFieldDescriptor instance to the internally maintained list of sequence elements.
|
boolean |
canAccept(String name,
String namespace,
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.
|
void |
checkDescriptorForCorrectOrderWithinSequence(XMLFieldDescriptor elementDescriptor,
UnmarshalState parentState,
String xmlName)
Checks whether the given XMLFieldDescriptor is the one actually expected, given the natural
order as defined by a sequence definition
|
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(String name,
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.
|
Class<?> |
getJavaClass()
Returns the Java class represented by this descriptor.
|
String |
getNameSpacePrefix()
Returns the namespace prefix to use when marshalling as XML.
|
String |
getNameSpaceURI()
Returns the namespace URI used when marshalling and unmarshalling as XML.
|
Object |
getProperty(String name) |
List<String> |
getSubstitutes() |
TypeValidator |
getValidator()
Returns a specific validator for the class described by this ClassDescriptor.
|
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.
|
boolean |
hasNature(String nature) |
boolean |
isChoice()
Indicates whether the XML artifact described by this descriptor is a
|
boolean |
isElementDefinition()
Returns true if XML schema definition of this Class is that of a global element or element with
anonymous type definition.
|
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
|
void |
setJavaClass(Class<?> type)
Sets the Class type being described by this descriptor.
|
void |
setNameSpacePrefix(String nsPrefix)
Sets the namespace prefix used when marshalling as XML.
|
void |
setNameSpaceURI(String nsURI)
Sets the namespace URI used when marshalling and unmarshalling as XML.
|
void |
setProperty(String name,
Object value) |
void |
setSubstitutes(List<String> substitutes) |
void |
setXMLName(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.
|
String |
toString()
Returns the String representation of this XMLClassDescriptor
|
void |
validate(Object object)
Validates the given Object
|
void |
validate(Object object,
ValidationContext context)
Validates the given object
|
checkUnresolvedIdrefspublic XMLClassDescriptorImpl(Class<?> type)
type - the Class type with which this ClassDescriptor describes.public XMLClassDescriptorImpl(Class<?> type, 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 void checkDescriptorForCorrectOrderWithinSequence(XMLFieldDescriptor elementDescriptor, UnmarshalState parentState, String xmlName) throws ValidationException
checkDescriptorForCorrectOrderWithinSequence in interface XMLClassDescriptorelementDescriptor - The XML field descriptor to be checkedxmlName - TODOValidationException - If the descriptor is not the one expectedpublic XMLFieldDescriptor getFieldDescriptor(String name, String namespace, NodeType nodeType)
If an field is matched in one of the container field, it will return the container field that contain the field named 'name'
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 String getNameSpacePrefix()
XMLClassDescriptorgetNameSpacePrefix in interface XMLClassDescriptorpublic String getNameSpaceURI()
XMLClassDescriptorgetNameSpaceURI in interface XMLClassDescriptorpublic TypeValidator getValidator()
getValidator in interface XMLClassDescriptorpublic 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(String nsPrefix)
nsPrefix - the namespace prefix used when marshalling the "described" objectpublic void setNameSpaceURI(String nsURI)
nsURI - the namespace URI used when marshalling and unmarshalling the "described" Object.public void setXMLName(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 String toString()
public void validate(Object object) throws ValidationException
validate in class Validatorobject - the Object to validateValidationException - if validation fails.public void validate(Object object, ValidationContext context) throws ValidationException
validate in interface TypeValidatorvalidate in interface ClassValidatorvalidate in class Validatorobject - the Object to validatecontext - the ValidationContextValidationException - if validation fails.public 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()
public boolean canAccept(String name, String namespace, 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)public void setJavaClass(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 void addSequenceElement(XMLFieldDescriptor element)
element - An XMLFieldDescriptor instance for an element definition.public boolean isChoice()
XMLClassDescriptorisChoice in interface XMLClassDescriptorpublic Object getProperty(String name)
getProperty in interface PropertyHoldername - of the propertygetProperty(java.lang.String)public void setProperty(String name, Object value)
setProperty in interface PropertyHoldername - of the propertyvalue - of the propertysetProperty(java.lang.String,
java.lang.Object)public void addNature(String nature)
addNature in interface NatureExtendablenature - ID of the NatureaddNature(java.lang.String)public boolean hasNature(String nature)
hasNature in interface NatureExtendablenature - ID of the NaturehasNature(java.lang.String)Copyright © 2016. All rights reserved.