Class DeadRef<T>

  • All Implemented Interfaces:
    Serializable, Comparable<Ref<T>>

    public class DeadRef<T>
    extends Ref<T>

    Implementation of Ref which is disconnected from the live system; for example, this will be used if a Ref gets serialized or deserialized.

    Author:
    Jeff Schnitzer
    See Also:
    Serialized Form
    • Constructor Detail

      • DeadRef

        protected DeadRef()
        For GWT serialization
      • DeadRef

        public DeadRef​(Key<T> key)
        Create a Ref based on the key
      • DeadRef

        public DeadRef​(Key<T> key,
                       T value)
        Create a Ref based on the key and value
    • Method Detail

      • get

        public T get()
        Description copied from class: Ref
        Obtain the entity value associated with the key. Will pull from session if present, otherwise will fetch from the datastore.
        Specified by:
        get in class Ref<T>
        Returns:
        the entity referenced, or null if the entity was not found
      • isLoaded

        public boolean isLoaded()
        Description copied from class: Ref
        If an entity has been loaded into the session or is otherwise available, this will return true. Calls to get() will not require a trip to backing store. Note that even when loaded, get() can still return null if there is no entity which corresponds to the key.
        Specified by:
        isLoaded in class Ref<T>
        Returns:
        true if the value is in the session or otherwise immediately available; false if get() will require a trip to the datastore or memcache.