Package com.sleepycat.persist.model
Class ClassMetadata
java.lang.Object
com.sleepycat.persist.model.ClassMetadata
- All Implemented Interfaces:
Serializable
The metadata for a persistent class. A persistent class may be specified
with the
Entity or Persistent annotation.
ClassMetadata objects are thread-safe. Multiple threads may
safely call the methods of a shared ClassMetadata object.
This and other metadata classes are classes rather than interfaces to allow adding properties to the model at a future date without causing incompatibilities. Any such property will be given a default value and its use will be optional.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionClassMetadata(String className, int version, String proxiedClassName, boolean entityClass, PrimaryKeyMetadata primaryKey, Map<String, SecondaryKeyMetadata> secondaryKeys, List<FieldMetadata> compositeKeyFields) Used by anEntityModelto construct persistent class metadata.ClassMetadata(String className, int version, String proxiedClassName, boolean entityClass, PrimaryKeyMetadata primaryKey, Map<String, SecondaryKeyMetadata> secondaryKeys, List<FieldMetadata> compositeKeyFields, Collection<FieldMetadata> persistentFields) Used by anEntityModelto construct persistent class metadata. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the name of the persistent class.Returns an unmodifiable list of metadata for the fields making up a composite key, or null if this is a not a composite key class.Returns an unmodifiable list of metadata for the persistent fields in this class, or null if the default rules for persistent fields should be used.Returns the primary key metadata for a key declared in this class, or null if none is declared.Returns the class name of the proxied class if this class is aPersistentProxy, or null otherwise.Returns an unmodifiable map of key name (which may be different from field name) to secondary key metadata for all secondary keys declared in this class, or null if no secondary keys are declared in this class.intReturns the version of this persistent class.inthashCode()booleanReturns whether this class is an entity class.
-
Constructor Details
-
ClassMetadata
public ClassMetadata(String className, int version, String proxiedClassName, boolean entityClass, PrimaryKeyMetadata primaryKey, Map<String, SecondaryKeyMetadata> secondaryKeys, List<FieldMetadata> compositeKeyFields) Used by anEntityModelto construct persistent class metadata. The optionalgetPersistentFields()property will be set to null. -
ClassMetadata
public ClassMetadata(String className, int version, String proxiedClassName, boolean entityClass, PrimaryKeyMetadata primaryKey, Map<String, SecondaryKeyMetadata> secondaryKeys, List<FieldMetadata> compositeKeyFields, Collection<FieldMetadata> persistentFields) Used by anEntityModelto construct persistent class metadata.
-
-
Method Details
-
getClassName
Returns the name of the persistent class. -
getVersion
public int getVersion()Returns the version of this persistent class. This may be specified using theEntity.version()orPersistent.version()annotation. -
getProxiedClassName
Returns the class name of the proxied class if this class is aPersistentProxy, or null otherwise. -
isEntityClass
public boolean isEntityClass()Returns whether this class is an entity class. -
getPrimaryKey
Returns the primary key metadata for a key declared in this class, or null if none is declared. This may be specified using thePrimaryKeyannotation. -
getSecondaryKeys
Returns an unmodifiable map of key name (which may be different from field name) to secondary key metadata for all secondary keys declared in this class, or null if no secondary keys are declared in this class. This metadata may be specified usingSecondaryKeyannotations. -
getCompositeKeyFields
Returns an unmodifiable list of metadata for the fields making up a composite key, or null if this is a not a composite key class. The order of the fields in the returned list determines their stored order and may be specified using theKeyFieldannotation. When the composite key class does not implementComparable, the order of the fields is the relative sort order. -
getPersistentFields
Returns an unmodifiable list of metadata for the persistent fields in this class, or null if the default rules for persistent fields should be used. All fields returned must be declared in this class and must be non-static.By default (if null is returned) the persistent fields of a class will be all declared instance fields that are non-transient (are not declared with the
transientkeyword). The default rules may be overridden by anEntityModel. For example, theAnnotationModeloverrides the default rules when theNotPersistentorNotTransientannotation is specified. -
equals
-
hashCode
public int hashCode()
-