Class 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 Detail

      • cacheEnabled

        protected boolean cacheEnabled
        True if any @Cached entities have been registered
    • Constructor Detail

      • Registrar

        public Registrar​(ObjectifyFactory fact)
        Parameters:
        fact - is so that the translations can be obtained
    • Method Detail

      • isCacheEnabled

        public boolean isCacheEnabled()
        Returns:
        true if any entities are cacheable
      • register

        public <T> void register​(Class<T> clazz)

        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

        public <T> EntityMetadata<T> getMetadata​(String kind)
        Returns:
        the metadata for the specified kind, or null if there was nothing appropriate registered
      • getMetadata

        public <T> EntityMetadata<T> getMetadata​(Class<T> clazz)
        Returns:
        the metadata for the specified class, or null if there was nothing appropriate registered