Package org.exolab.castor.mapping.loader
Class ClassDescriptorImpl
- java.lang.Object
-
- org.exolab.castor.mapping.loader.ClassDescriptorImpl
-
- All Implemented Interfaces:
NatureExtendable
,PropertyHolder
,ClassDescriptor
public class ClassDescriptorImpl extends java.lang.Object implements ClassDescriptor
The standardClassDescriptor
implementation, holding general OO information about the class described. Engines will useNature
s to augment this class with engine-specific knowledge and functionality, usingaddNature(String)
to register these views with this class. Once a Nature has been registered with thisClassDescriptor
, the nature can be applied to theClassDescriptor
and nature-specific properties can be accessed in a type-safe way.- Version:
- $Revision: 8727 $ $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
Constructors Constructor Description ClassDescriptorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNature(java.lang.String nature)
Adds a specified nature.ClassDescriptor
getDepends()
Returns theClassDescriptor
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 theFieldDescriptor
s that describe the identities as defined for this class.FieldDescriptor
getIdentity()
Returns the firstFieldDescriptor
instance.java.lang.Class<?>
getJavaClass()
Returns the Java class represented by this descriptor.ClassMapping
getMapping()
Returns theClassMapping
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 theClassDescriptor
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 theFieldDescriptor
s that describe the fields defined for this class.void
setIdentities(FieldDescriptor[] identities)
Sets theFieldDescriptor
s that describe the identities as defined for this class.void
setJavaClass(java.lang.Class<?> javaClass)
Sets the JavaClass
as described by this descriptor.void
setMapping(ClassMapping mapping)
Sets theClassMapping
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()
-
-
-
Method Detail
-
setMapping
public void setMapping(ClassMapping mapping)
Sets theClassMapping
instance.- Parameters:
mapping
- TheClassMapping
instance to be used.
-
getMapping
public ClassMapping getMapping()
Returns theClassMapping
instance used.- Returns:
- The
ClassMapping
instance used.
-
setJavaClass
public void setJavaClass(java.lang.Class<?> javaClass)
Sets the JavaClass
as described by this descriptor.- Parameters:
javaClass
- The JavaClass
instance as described by this descriptor.
-
getJavaClass
public java.lang.Class<?> getJavaClass()
Returns the Java class represented by this descriptor.- Specified by:
getJavaClass
in interfaceClassDescriptor
- 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 interfaceClassDescriptor
- Returns:
- The extended class descriptor
- See Also:
ClassDescriptor.getExtends()
-
setDepends
public void setDepends(ClassDescriptor depends)
Sets theClassDescriptor
of the class which this class depends upon.- Parameters:
depends
- theClassDescriptor
of the class which this class depends upon
-
getDepends
public ClassDescriptor getDepends()
Returns theClassDescriptor
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 theFieldDescriptor
s that describe the fields defined for this class.- Parameters:
fields
- theFieldDescriptor
s 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 interfaceClassDescriptor
- Returns:
- A list of fields
- See Also:
ClassDescriptor.getFields()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.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 interfacePropertyHolder
- Parameters:
name
- of the property- Returns:
- value of the property
-
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 interfacePropertyHolder
- Parameters:
name
- of the propertyvalue
- of the property
-
addNature
public void addNature(java.lang.String nature)
Description copied from interface:NatureExtendable
Adds a specified nature.- Specified by:
addNature
in interfaceNatureExtendable
- Parameters:
nature
- ID of the Nature
-
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 interfaceNatureExtendable
- Parameters:
nature
- ID of the Nature- Returns:
- true if the Nature ID was added.
-
setIdentities
public void setIdentities(FieldDescriptor[] identities)
Sets theFieldDescriptor
s that describe the identities as defined for this class.- Parameters:
identities
- theFieldDescriptor
s that describe the identities as defined for this class.
-
getIdentities
public FieldDescriptor[] getIdentities()
Returns theFieldDescriptor
s that describe the identities as defined for this class.- Returns:
- the
FieldDescriptor
s that describe the identities as defined for this class.
-
getIdentity
public FieldDescriptor getIdentity()
Returns the firstFieldDescriptor
instance.- Specified by:
getIdentity
in interfaceClassDescriptor
- Returns:
- the first
FieldDescriptor
instance
-
-