org.exolab.castor.xml.descriptors
Class BaseDescriptor

java.lang.Object
  extended by org.exolab.castor.xml.descriptors.BaseDescriptor
All Implemented Interfaces:
NatureExtendable, PropertyHolder, ClassDescriptor, XMLClassDescriptor
Direct Known Subclasses:
DateClassDescriptor, ListClassDescriptor, LocaleDescriptor, RootArrayDescriptor, SQLDateClassDescriptor, SQLTimeClassDescriptor, SQLTimestampClassDescriptor, StringClassDescriptor, VectorClassDescriptor

public abstract class BaseDescriptor
extends java.lang.Object
implements XMLClassDescriptor


Constructor Summary
BaseDescriptor()
           
 
Method Summary
 void addNature(java.lang.String nature)
          Adds a specified nature.
 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 member whose name is given.
 void checkDescriptorForCorrectOrderWithinSequence(XMLFieldDescriptor elementDescriptor, UnmarshalState parentState, java.lang.String xmlName)
          Checks whether the given XMLFieldDescriptor is the one actually expected, given the natural order as defined by a sequence definition
 java.lang.Object getProperty(java.lang.String name)
          Get a property by its name.
 boolean hasNature(java.lang.String nature)
          Checks if a specified nature has been added.
 boolean isChoice()
          Indicates whether the XML artifact described by this descriptor is a .
 void setProperty(java.lang.String name, java.lang.Object value)
          Set a property specified by the name to the passed value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exolab.castor.xml.XMLClassDescriptor
getAttributeDescriptors, getContentDescriptor, getElementDescriptors, getFieldDescriptor, getNameSpacePrefix, getNameSpaceURI, getValidator, getXMLName
 
Methods inherited from interface org.exolab.castor.mapping.ClassDescriptor
getExtends, getFields, getIdentity, getJavaClass
 

Constructor Detail

BaseDescriptor

public BaseDescriptor()
Method Detail

canAccept

public 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 member whose name is given. An XMLClassDescriptor can accept a field if it contains a descriptor that matches the given name and if the given object can hold this field (i.e a value is not already set for this field).

This is mainly used for container object (that can contain other objects), in this particular case the implementation returns false.

Specified by:
canAccept in interface XMLClassDescriptor
Parameters:
name - the name of the field to check
namespace - the namespace of the element. This may be null. Note: A null namespace is not the same as the default namespace unless the default namespace is also null.
object - the object represented by this XMLCLassDescriptor
Returns:
true if the given object represented by this XMLClassDescriptor can accept a member whose name is given.

checkDescriptorForCorrectOrderWithinSequence

public void checkDescriptorForCorrectOrderWithinSequence(XMLFieldDescriptor elementDescriptor,
                                                         UnmarshalState parentState,
                                                         java.lang.String xmlName)
                                                  throws ValidationException
Checks whether the given XMLFieldDescriptor is the one actually expected, given the natural order as defined by a sequence definition

Specified by:
checkDescriptorForCorrectOrderWithinSequence in interface XMLClassDescriptor
Parameters:
elementDescriptor - The XML field descriptor to be checked
xmlName - TODO
Throws:
ValidationException - If the descriptor is not the one expected
See Also:
checkDescriptorForCorrectOrderWithinSequence(org.exolab.castor.xml.XMLFieldDescriptor, org.exolab.castor.xml.UnmarshalState, java.lang.String)

isChoice

public boolean isChoice()
Indicates whether the XML artifact described by this descriptor is a .

Specified by:
isChoice in interface XMLClassDescriptor
Returns:
True if the artifact described is a choice.
See Also:
XMLClassDescriptor.isChoice()

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: PropertyHolder
Get a property by its name.

Specified by:
getProperty in interface PropertyHolder
Parameters:
name - of the property
Returns:
value of the property
See Also:
getProperty(java.lang.String)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Description copied from interface: PropertyHolder
Set a property specified by the name to the passed value.

Specified by:
setProperty in interface PropertyHolder
Parameters:
name - of the property
value - of the property
See Also:
setProperty(java.lang.String, java.lang.Object)

addNature

public void addNature(java.lang.String nature)
Description copied from interface: NatureExtendable
Adds a specified nature.

Specified by:
addNature in interface NatureExtendable
Parameters:
nature - ID of the Nature
See Also:
addNature(java.lang.String)

hasNature

public boolean hasNature(java.lang.String nature)
Description copied from interface: NatureExtendable
Checks if a specified nature has been added.

Specified by:
hasNature in interface NatureExtendable
Parameters:
nature - ID of the Nature
Returns:
true if the Nature ID was added.
See Also:
hasNature(java.lang.String)


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com