org.exolab.castor.mapping.loader
Class ClassDescriptorImpl

java.lang.Object
  extended by org.exolab.castor.mapping.loader.ClassDescriptorImpl
All Implemented Interfaces:
ClassDescriptor
Direct Known Subclasses:
JDOClassDescriptor

public class ClassDescriptorImpl
extends java.lang.Object
implements ClassDescriptor

A basic class descriptor implementation. Engines will extend this class to provide additional functionality.

Version:
$Revision: 1.3 $ $Date: 2005/07/15 21:59:17 $
Author:
Assaf Arkin

Field Summary
protected  FieldDescriptor[] _fields
          The fields described for this class.
protected  FieldDescriptor[] _identities
          The field of the identity for this class.
 
Constructor Summary
protected ClassDescriptorImpl(java.lang.Class javaClass)
          Constructor used by derived classes.
  ClassDescriptorImpl(java.lang.Class javaClass, FieldDescriptor[] fields, FieldDescriptor[] identities, ClassDescriptor extend, ClassDescriptor depend, AccessMode accessMode)
          Constructs a new descriptor for the specified class.
  ClassDescriptorImpl(java.lang.Class javaClass, FieldDescriptor[] fields, FieldDescriptor[] identities, ClassDescriptor extend, ClassDescriptor depend, AccessMode accessMode, boolean verifyConstructable)
          Constructs a new descriptor for the specified class.
 
Method Summary
 void addExtendedBy(ClassDescriptor classDesc)
           
 void checkValidity(java.lang.Object object)
          Checks the object validity.
 AccessMode getAccessMode()
          Returns the access mode specified for this class.
 ClassDescriptor getDepends()
           
 java.util.Collection getExtendedBy()
          Returns a collection of class descriptors that extend this class descriptor.
 ClassDescriptor getExtends()
          Returns the class descriptor of the class extended by this class.
 FieldDescriptor[] getFields()
          Returns a list of fields represented by this descriptor.
 FieldDescriptor[] getIdentities()
           
 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.
 ClassMapping getMapping()
           
 boolean isExtended()
           
 boolean isExtending()
           
 void setMapping(ClassMapping map)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_fields

protected final FieldDescriptor[] _fields
The fields described for this class.


_identities

protected final FieldDescriptor[] _identities
The field of the identity for this class.

Constructor Detail

ClassDescriptorImpl

public ClassDescriptorImpl(java.lang.Class javaClass,
                           FieldDescriptor[] fields,
                           FieldDescriptor[] identities,
                           ClassDescriptor extend,
                           ClassDescriptor depend,
                           AccessMode accessMode)
                    throws MappingException
Constructs a new descriptor for the specified class. When describing inheritence, the descriptor of the parent class should be used and only the fields added in this object must be supplied here.

Parameters:
javaClass - The Java type of this class
fields - The fields described for this class
identities - The array of the identities (key) of this class, may be null
extend - The descriptor of the class which this class extends,
accessMode - The access mode for this class (null is shared) or null if this is a top-level class
Throws:
MappingException - The extended descriptor does not match a parent class of this type

ClassDescriptorImpl

public ClassDescriptorImpl(java.lang.Class javaClass,
                           FieldDescriptor[] fields,
                           FieldDescriptor[] identities,
                           ClassDescriptor extend,
                           ClassDescriptor depend,
                           AccessMode accessMode,
                           boolean verifyConstructable)
                    throws MappingException
Constructs a new descriptor for the specified class. When describing inheritence, the descriptor of the parent class should be used and only the fields added in this object must be supplied here.

Parameters:
javaClass - The Java type of this class
fields - The fields described for this class
identities - The field of the identities (key) of this class, may be null
extend - The descriptor of the class which this class extends,
accessMode - The access mode for this class (null is shared) or null if this is a top-level class
Throws:
MappingException - The extended descriptor does not match a parent class of this type

ClassDescriptorImpl

protected ClassDescriptorImpl(java.lang.Class javaClass)
Constructor used by derived classes.

Method Detail

getMapping

public ClassMapping getMapping()

setMapping

public void setMapping(ClassMapping map)

getJavaClass

public java.lang.Class getJavaClass()
Description copied from interface: ClassDescriptor
Returns the Java class represented by this descriptor.

Specified by:
getJavaClass in interface ClassDescriptor
Returns:
The Java class

getFields

public FieldDescriptor[] getFields()
Description copied from interface: ClassDescriptor
Returns a list of fields represented by this descriptor.

Specified by:
getFields in interface ClassDescriptor
Returns:
A list of fields

getExtends

public ClassDescriptor getExtends()
Description copied from interface: ClassDescriptor
Returns the class descriptor of the class extended by this class.

Specified by:
getExtends in interface ClassDescriptor
Returns:
The extended class descriptor

isExtending

public boolean isExtending()

getExtendedBy

public java.util.Collection getExtendedBy()
Returns a collection of class descriptors that extend this class descriptor.

Returns:
A collection of class descriptors.

isExtended

public boolean isExtended()

addExtendedBy

public void addExtendedBy(ClassDescriptor classDesc)

getDepends

public ClassDescriptor getDepends()

getIdentity

public FieldDescriptor getIdentity()
Description copied from interface: ClassDescriptor
Returns the identity field, null if this class has no identity.

Specified by:
getIdentity in interface ClassDescriptor
Returns:
The identity field

getIdentities

public FieldDescriptor[] getIdentities()

getAccessMode

public AccessMode getAccessMode()
Description copied from interface: ClassDescriptor
Returns the access mode specified for this class.

Specified by:
getAccessMode in interface ClassDescriptor
Returns:
The access mode

checkValidity

public void checkValidity(java.lang.Object object)
                   throws ValidityException,
                          java.lang.IllegalStateException
Checks the object validity. Returns successfully if the object can be stored, is valid, etc, throws an exception otherwise.

Parameters:
object - The object
Throws:
ValidityException - The object is invalid, a required is null, or any other validity violation
java.lang.IllegalStateException - The Java object has changed and is no longer supported by this handler, or the handler is not compatiable with the Java object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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