Package com.googlecode.objectify.impl
Class Registrar
java.lang.Object
com.googlecode.objectify.impl.Registrar
public class Registrar extends Object
Maintains information about registered entity classes
There logic here is convoluted by polymorphic hierarchies. Entity classes can be registered in any particular order, requiring some considerable care.
- Author:
- Jeff Schnitzer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,EntityMetadata<?>>
This maps kind to EntityMetadataprotected boolean
True if any @Cached entities have been registeredprotected ObjectifyFactory
Needed to obtain the converters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> EntityMetadata<T>
getMetadata(Class<T> clazz)
<T> EntityMetadata<T>
getMetadata(String kind)
<T> EntityMetadata<T>
getMetadataSafe(Class<T> clazz)
<T> EntityMetadata<T>
getMetadataSafe(String kind)
Gets metadata for the specified kindboolean
<T> void
All @Entity and @Subclass classes (for both entity and embedded classes) must be registered before using Objectify to load or save data.
-
Field Details
-
fact
Needed to obtain the converters -
byKind
This maps kind to EntityMetadata -
cacheEnabled
protected boolean cacheEnabledTrue if any @Cached entities have been registered
-
-
Constructor Details
-
Registrar
- Parameters:
fact
- is so that the translations can be obtained
-
-
Method Details
-
isCacheEnabled
public boolean isCacheEnabled()- Returns:
- true if any entities are cacheable
-
register
All @Entity and @Subclass classes (for both entity and embedded classes) must be registered before using Objectify to load or save data. This method must be called in a single-threaded mode sometime around application initialization.
Re-registering a class has no effect.
- Parameters:
clazz
- must be annotated with either @Entity or @Subclass
-
getMetadata
- Returns:
- the metadata for the specified kind, or null if there was nothing appropriate registered
-
getMetadata
- Returns:
- the metadata for the specified class, or null if there was nothing appropriate registered
-
getMetadataSafe
Gets metadata for the specified kind- Throws:
IllegalArgumentException
- if the kind has not been registered
-
getMetadataSafe
- Returns:
- the metadata for a kind of typed object
- Throws:
IllegalArgumentException
- if the kind has not been registered
-