Class ClassDescriptorJDONature
- java.lang.Object
-
- org.castor.core.nature.BaseNature
-
- org.exolab.castor.jdo.engine.nature.ClassDescriptorJDONature
-
- All Implemented Interfaces:
Nature
public class ClassDescriptorJDONature extends BaseNature
JDO-specific nature forClassDescriptor.
AugmentsClassDescriptorto include persistence-specific data such as e.g. the table name, cache parameter, key generators, access mode and other SQL-related information.
To access persistence-specific data of aClassDescriptor, use the following code fragment to ...- check for this nature
- apply this nature to the
ClassDescriptorin question. - access e.g. the table name.
ClassDescriptor classDescriptor = ...; ... if (classDescriptor.hasNature(ClassDescriptorJDONature.class.getName()) { 1) ClassDescriptorJDONature nature = new ClassDescriptorJDONature(classDescriptor); 2) ... String tableName = nature.getTableName(); 3) }- Since:
- 1.2.1
- Author:
- Werner Guttmann
-
-
Constructor Summary
Constructors Constructor Description ClassDescriptorJDONature(PropertyHolder holder)Creates an instance ofClassDescriptorJDONature.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCacheParam(java.lang.String key, java.lang.String value)Adds a cache parameter to thisClassDescriptor.voidaddExtended(ClassDescriptor classDesc)Adds aClassDescriptorthat extends this class.voidaddNamedNativeQuery(java.lang.String name, NamedNativeQuery query)Adds a named query to thisClassDescriptor.voidaddNamedQuery(java.lang.String name, java.lang.String query)Adds a named query to thisClassDescriptor.AccessModegetAccessMode()Returns the access mode to which this object maps.java.util.PropertiesgetCacheParams()Returns the cache parameters defined for thisClassDescriptor.java.util.Collection<ClassDescriptor>getExtended()Returns a collection ofClassDescriptors that extend this class (descriptor).FieldDescriptorgetField(java.lang.String name)Returns theFieldDescriptorfor the given name.java.lang.StringgetId()Returns the fully qualified name of the Nature.KeyGeneratorDescriptorgetKeyGeneratorDescriptor()Get key generator specified for this class.java.util.Map<java.lang.String,NamedNativeQuery>getNamedNativeQueries()Get map of named native queries associated with their names.java.util.Map<java.lang.String,java.lang.String>getNamedQueries()Get map of named query strings associated with their names.java.lang.StringgetTableName()Returns the table name to which this object maps.java.lang.StringgetVersionField()Returns the name of the version field used for checks on object modifications.booleanhasMappedSuperclass()Returns if class has mapped super class.voidsetAbstract(java.lang.Boolean hasMappedSuperclass)Set class to abstractvoidsetAccessMode(AccessMode accessMode)Sets the access mode to which thisClassDescriptormaps.voidsetKeyGeneratorDescriptor(KeyGeneratorDescriptor keyGenDesc)Set key generator specified for this class.voidsetTableName(java.lang.String tableName)Sets the table name to which this object maps.voidsetVersionField(java.lang.String versionField)Sets the version field to use for object modification checks.-
Methods inherited from class org.castor.core.nature.BaseNature
getBooleanPropertyDefaultFalse, getHolder, getProperty, getPropertyAsList, getPropertyAsMap, setProperty
-
-
-
-
Constructor Detail
-
ClassDescriptorJDONature
public ClassDescriptorJDONature(PropertyHolder holder)
Creates an instance ofClassDescriptorJDONature.- Parameters:
holder- ThePropertyHolderto 'view upon'.
-
-
Method Detail
-
getId
public java.lang.String getId()
Returns the fully qualified name of the Nature.- Returns:
- qualified name of the nature.
- See Also:
Nature.getId()
-
setAbstract
public void setAbstract(java.lang.Boolean hasMappedSuperclass)
Set class to abstract- Parameters:
abstract- Boolean
-
hasMappedSuperclass
public boolean hasMappedSuperclass()
Returns if class has mapped super class.- Returns:
- true if class hs mapped super class
-
setTableName
public void setTableName(java.lang.String tableName)
Sets the table name to which this object maps.- Parameters:
tableName- Table name
-
getTableName
public java.lang.String getTableName()
Returns the table name to which this object maps.- Returns:
- Table name
-
setAccessMode
public void setAccessMode(AccessMode accessMode)
Sets the access mode to which thisClassDescriptormaps.- Parameters:
accessMode- The access mode to be used.
-
getAccessMode
public AccessMode getAccessMode()
Returns the access mode to which this object maps.- Returns:
- Access mode
-
setKeyGeneratorDescriptor
public void setKeyGeneratorDescriptor(KeyGeneratorDescriptor keyGenDesc)
Set key generator specified for this class.- Parameters:
keyGenDesc- Key generator descriptor.
-
getKeyGeneratorDescriptor
public KeyGeneratorDescriptor getKeyGeneratorDescriptor()
Get key generator specified for this class.- Returns:
- Key generator descriptor.
-
addCacheParam
public void addCacheParam(java.lang.String key, java.lang.String value)Adds a cache parameter to thisClassDescriptor.- Parameters:
key- The cache parameter key.value- The cache parameter value.
-
getCacheParams
public java.util.Properties getCacheParams()
Returns the cache parameters defined for thisClassDescriptor.- Returns:
- the defined cache parameters
-
addNamedQuery
public void addNamedQuery(java.lang.String name, java.lang.String query)Adds a named query to thisClassDescriptor.- Parameters:
name- The name of the named query.query- The query string
-
getNamedQueries
public java.util.Map<java.lang.String,java.lang.String> getNamedQueries()
Get map of named query strings associated with their names.- Returns:
- Map of named query strings associated with their names.
-
getVersionField
public java.lang.String getVersionField()
Returns the name of the version field used for checks on object modifications.- Returns:
- The name of the version field,
nullif not set.
-
addNamedNativeQuery
public void addNamedNativeQuery(java.lang.String name, NamedNativeQuery query)Adds a named query to thisClassDescriptor.- Parameters:
name- The name of the named query.query- The query string
-
getNamedNativeQueries
public java.util.Map<java.lang.String,NamedNativeQuery> getNamedNativeQueries()
Get map of named native queries associated with their names.- Returns:
- Map of named native queries associated with their names.
-
getField
public FieldDescriptor getField(java.lang.String name)
Returns theFieldDescriptorfor the given name.- Parameters:
name- A field name.- Returns:
- The associated
FieldDescriptor.
-
addExtended
public void addExtended(ClassDescriptor classDesc)
Adds aClassDescriptorthat extends this class.- Parameters:
classDesc- AClassDescriptorthat extends this class.
-
getExtended
public java.util.Collection<ClassDescriptor> getExtended()
Returns a collection ofClassDescriptors that extend this class (descriptor).- Returns:
- A collection of
ClassDescriptors that extend this class.
-
setVersionField
public void setVersionField(java.lang.String versionField)
Sets the version field to use for object modification checks.- Parameters:
versionField- the name of the field.
-
-