Class ClassDescriptorJDONature
java.lang.Object
org.castor.core.nature.BaseNature
org.exolab.castor.jdo.engine.nature.ClassDescriptorJDONature
- All Implemented Interfaces:
Nature
JDO-specific nature for
Augments
To access persistence-specific data of a
ClassDescriptor
.Augments
ClassDescriptor
to 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 a
ClassDescriptor
, use the
following code fragment to ...
- check for this nature
- apply this nature to the
ClassDescriptor
in 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCacheParam
(String key, String value) Adds a cache parameter to thisClassDescriptor
.void
addExtended
(ClassDescriptor classDesc) Adds aClassDescriptor
that extends this class.void
addNamedNativeQuery
(String name, NamedNativeQuery query) Adds a named query to thisClassDescriptor
.void
addNamedQuery
(String name, String query) Adds a named query to thisClassDescriptor
.Returns the access mode to which this object maps.Returns the cache parameters defined for thisClassDescriptor
.Returns a collection ofClassDescriptor
s that extend this class (descriptor).Returns theFieldDescriptor
for the given name.getId()
Returns the fully qualified name of the Nature.Get key generator specified for this class.Get map of named native queries associated with their names.Get map of named query strings associated with their names.Returns the table name to which this object maps.Returns the name of the version field used for checks on object modifications.boolean
Returns if class has mapped super class.void
setAbstract
(Boolean hasMappedSuperclass) Set class to abstractvoid
setAccessMode
(AccessMode accessMode) Sets the access mode to which thisClassDescriptor
maps.void
setKeyGeneratorDescriptor
(KeyGeneratorDescriptor keyGenDesc) Set key generator specified for this class.void
setTableName
(String tableName) Sets the table name to which this object maps.void
setVersionField
(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 Details
-
ClassDescriptorJDONature
Creates an instance ofClassDescriptorJDONature
.- Parameters:
holder
- ThePropertyHolder
to 'view upon'.
-
-
Method Details
-
getId
Returns the fully qualified name of the Nature.- Returns:
- qualified name of the nature.
- See Also:
-
setAbstract
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
Sets the table name to which this object maps.- Parameters:
tableName
- Table name
-
getTableName
Returns the table name to which this object maps.- Returns:
- Table name
-
setAccessMode
Sets the access mode to which thisClassDescriptor
maps.- Parameters:
accessMode
- The access mode to be used.
-
getAccessMode
Returns the access mode to which this object maps.- Returns:
- Access mode
-
setKeyGeneratorDescriptor
Set key generator specified for this class.- Parameters:
keyGenDesc
- Key generator descriptor.
-
getKeyGeneratorDescriptor
Get key generator specified for this class.- Returns:
- Key generator descriptor.
-
addCacheParam
Adds a cache parameter to thisClassDescriptor
.- Parameters:
key
- The cache parameter key.value
- The cache parameter value.
-
getCacheParams
Returns the cache parameters defined for thisClassDescriptor
.- Returns:
- the defined cache parameters
-
addNamedQuery
Adds a named query to thisClassDescriptor
.- Parameters:
name
- The name of the named query.query
- The query string
-
getNamedQueries
Get map of named query strings associated with their names.- Returns:
- Map of named query strings associated with their names.
-
getVersionField
Returns the name of the version field used for checks on object modifications.- Returns:
- The name of the version field,
null
if not set.
-
addNamedNativeQuery
Adds a named query to thisClassDescriptor
.- Parameters:
name
- The name of the named query.query
- The query string
-
getNamedNativeQueries
Get map of named native queries associated with their names.- Returns:
- Map of named native queries associated with their names.
-
getField
Returns theFieldDescriptor
for the given name.- Parameters:
name
- A field name.- Returns:
- The associated
FieldDescriptor
.
-
addExtended
Adds aClassDescriptor
that extends this class.- Parameters:
classDesc
- AClassDescriptor
that extends this class.
-
getExtended
Returns a collection ofClassDescriptor
s that extend this class (descriptor).- Returns:
- A collection of
ClassDescriptor
s that extend this class.
-
setVersionField
Sets the version field to use for object modification checks.- Parameters:
versionField
- the name of the field.
-