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 for 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 ...
  1. check for this nature
  2. apply this nature to the ClassDescriptor in question.
  3. access e.g. the table name.
Sample - Looking up 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 Details

  • Method Details

    • getId

      public String getId()
      Returns the fully qualified name of the Nature.
      Returns:
      qualified name of the nature.
      See Also:
    • setAbstract

      public void setAbstract(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(String tableName)
      Sets the table name to which this object maps.
      Parameters:
      tableName - Table name
    • getTableName

      public 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 this ClassDescriptor maps.
      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(String key, String value)
      Adds a cache parameter to this ClassDescriptor.
      Parameters:
      key - The cache parameter key.
      value - The cache parameter value.
    • getCacheParams

      public Properties getCacheParams()
      Returns the cache parameters defined for this ClassDescriptor.
      Returns:
      the defined cache parameters
    • addNamedQuery

      public void addNamedQuery(String name, String query)
      Adds a named query to this ClassDescriptor.
      Parameters:
      name - The name of the named query.
      query - The query string
    • getNamedQueries

      public Map<String,String> getNamedQueries()
      Get map of named query strings associated with their names.
      Returns:
      Map of named query strings associated with their names.
    • getVersionField

      public String 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

      public void addNamedNativeQuery(String name, NamedNativeQuery query)
      Adds a named query to this ClassDescriptor.
      Parameters:
      name - The name of the named query.
      query - The query string
    • getNamedNativeQueries

      public Map<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(String name)
      Returns the FieldDescriptor for the given name.
      Parameters:
      name - A field name.
      Returns:
      The associated FieldDescriptor.
    • addExtended

      public void addExtended(ClassDescriptor classDesc)
      Adds a ClassDescriptor that extends this class.
      Parameters:
      classDesc - A ClassDescriptor that extends this class.
    • getExtended

      public Collection<ClassDescriptor> getExtended()
      Returns a collection of ClassDescriptors that extend this class (descriptor).
      Returns:
      A collection of ClassDescriptors that extend this class.
    • setVersionField

      public void setVersionField(String versionField)
      Sets the version field to use for object modification checks.
      Parameters:
      versionField - the name of the field.