org.exolab.castor.mapping.loader
Class ClassDescriptorImpl

java.lang.Object
  extended by org.exolab.castor.mapping.loader.ClassDescriptorImpl
All Implemented Interfaces:
NatureExtendable, PropertyHolder, ClassDescriptor

public class ClassDescriptorImpl
extends java.lang.Object
implements ClassDescriptor

The standard ClassDescriptor implementation, holding general OO information about the class described.

Engines will use Natures to augment this class with engine-specific knowledge and functionality, using addNature(String) to register these views with this class.

Once a Nature has been registered with this ClassDescriptor, the nature can be applied to the ClassDescriptor and nature-specific properties can be accessed in a type-safe way.

Version:
$Revision: 7794 $ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $
Author:
Assaf Arkin, Ralf Joachim, Werner Guttmann
See Also:
Nature, addNature(String), hasNature(String)

Constructor Summary
ClassDescriptorImpl()
           
 
Method Summary
 void addNature(java.lang.String nature)
          Adds a specified nature.
 ClassDescriptor getDepends()
          Returns the ClassDescriptor of the class which this class depends upon.
 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()
          Returns the FieldDescriptors that describe the identities as defined for this class.
 FieldDescriptor getIdentity()
          Returns the first FieldDescriptor instance.
 java.lang.Class getJavaClass()
          Returns the Java class represented by this descriptor.
 ClassMapping getMapping()
          Returns the ClassMapping instance used.
 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.
 void setDepends(ClassDescriptor depends)
          Sets the ClassDescriptor of the class which this class depends upon.
 void setExtends(ClassDescriptor extend)
          Sets the descriptor of the class which this class extends.
 void setFields(FieldDescriptor[] fields)
          Sets the FieldDescriptors that describe the fields defined for this class.
 void setIdentities(FieldDescriptor[] identities)
          Sets the FieldDescriptors that describe the identities as defined for this class.
 void setJavaClass(java.lang.Class javaClass)
          Sets the Java Class as described by this descriptor.
 void setMapping(ClassMapping mapping)
          Sets the ClassMapping instance.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set a property specified by the name to the passed value.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassDescriptorImpl

public ClassDescriptorImpl()
Method Detail

setMapping

public void setMapping(ClassMapping mapping)
Sets the ClassMapping instance.

Parameters:
mapping - The ClassMapping instance to be used.

getMapping

public ClassMapping getMapping()
Returns the ClassMapping instance used.

Returns:
The ClassMapping instance used.

setJavaClass

public void setJavaClass(java.lang.Class javaClass)
Sets the Java Class as described by this descriptor.

Parameters:
javaClass - The Java Class instance as described by this descriptor.

getJavaClass

public java.lang.Class getJavaClass()
Returns the Java class represented by this descriptor.

Specified by:
getJavaClass in interface ClassDescriptor
Returns:
The Java class
See Also:
ClassDescriptor.getJavaClass()

setExtends

public void setExtends(ClassDescriptor extend)
Sets the descriptor of the class which this class extends.

Parameters:
extend - the descriptor of the class which this class extends.

getExtends

public ClassDescriptor getExtends()
Returns the class descriptor of the class extended by this class.

Specified by:
getExtends in interface ClassDescriptor
Returns:
The extended class descriptor
See Also:
ClassDescriptor.getExtends()

setDepends

public void setDepends(ClassDescriptor depends)
Sets the ClassDescriptor of the class which this class depends upon.

Parameters:
depends - the ClassDescriptor of the class which this class depends upon

getDepends

public ClassDescriptor getDepends()
Returns the ClassDescriptor of the class which this class depends upon.

Returns:
the ClassDescriptor of the class which this class depends upon.

setFields

public void setFields(FieldDescriptor[] fields)
Sets the FieldDescriptors that describe the fields defined for this class.

Parameters:
fields - the FieldDescriptors that describe the fields defined for this class.

getFields

public FieldDescriptor[] getFields()
Returns a list of fields represented by this descriptor.

Specified by:
getFields in interface ClassDescriptor
Returns:
A list of fields
See Also:
ClassDescriptor.getFields()

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

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)

setIdentities

public void setIdentities(FieldDescriptor[] identities)
Sets the FieldDescriptors that describe the identities as defined for this class.

Parameters:
identities - the FieldDescriptors that describe the identities as defined for this class.

getIdentities

public FieldDescriptor[] getIdentities()
Returns the FieldDescriptors that describe the identities as defined for this class.

Returns:
the FieldDescriptors that describe the identities as defined for this class.

getIdentity

public FieldDescriptor getIdentity()
Returns the first FieldDescriptor instance.

Specified by:
getIdentity in interface ClassDescriptor
Returns:
the first FieldDescriptor instance


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