|
Berkeley DB Java Edition version 3.0.12 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.persist.model.EntityModel
public abstract class EntityModel
The base class for classes that provide entity model metadata. An EntityModel
defines entity classes, primary keys, secondary keys, and
relationships between entities. For each entity class that is part of the
model, a single PrimaryIndex
object and zero or more SecondaryIndex
objects may be accessed via an EntityStore
.
The built-in entity model, the AnnotationModel
, is based on
annotations that are added to entity classes and their key fields.
Annotations are used in the examples in this package, and it is expected
that annotations will normally be used; most readers should therefore skip
to the AnnotationModel
class. However, a custom entity model class
may define its own metadata. This can be used to define entity classes and
keys using mechanisms other than annotations.
A concrete entity model class should extend this class and implement the
getClassMetadata(java.lang.String)
, getEntityMetadata(java.lang.String)
and getKnownClasses()
methods.
This is an abstract class rather than an interface to allow adding capabilities to the model at a future date without causing incompatibilities. For example, a method may be added in the future for returning new information about the model and subclasses may override this method to return the new information. Any new methods will have default implementations that return default values, and the use of the new information will be optional.
Constructor Summary | |
---|---|
protected |
EntityModel()
The default constructor for use by subclasses. |
Method Summary | |
---|---|
SortedMap<Integer,RawType> |
getAllRawTypes(String className)
Returns all known versions of type information for a given class name, or null if the class is not persistent. |
abstract ClassMetadata |
getClassMetadata(String className)
Returns the metadata for a given persistent class name, including proxy classes and entity classes. |
abstract EntityMetadata |
getEntityMetadata(String className)
Returns the metadata for a given entity class name. |
abstract Set<String> |
getKnownClasses()
Returns the names of all known persistent classes. |
RawType |
getRawType(String className)
Returns the type information for the current version of a given class, or null if the class is not persistent. |
void |
registerClass(Class persistentClass)
Registers a persistent class, most importantly, a PersistentProxy class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected EntityModel()
Method Detail |
---|
public final void registerClass(Class persistentClass)
PersistentProxy
class. Any persistent class may be registered in
advance of using it, to avoid the overhead of updating the catalog
database when an instance of the class is first stored. This method
must be called to register PersistentProxy
classes.
This method must be called before opening a store based on this model.
IllegalStateException
- if this method is called for a model that
is associated with an open store.
IllegalArgumentException
- if the given class is not persistent.public abstract ClassMetadata getClassMetadata(String className)
public abstract EntityMetadata getEntityMetadata(String className)
public abstract Set<String> getKnownClasses()
IllegalStateException
- if this method is called for a model that
is not associated with an open store.public final RawType getRawType(String className)
IllegalStateException
- if this method is called for a model that
is not associated with an open store.public final SortedMap<Integer,RawType> getAllRawTypes(String className)
RawType
.
IllegalStateException
- if this method is called for a model that
is not associated with an open store.
|
Berkeley DB Java Edition version 3.0.12 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |