Entity (Google App Engine API for Java)

com.google.appengine.api.datastore

Class Entity

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable


    public final class Entity
    extends PropertyContainer
    implements java.lang.Cloneable
    Entity is the fundamental unit of data storage. It has an immutable identifier (contained in the Key) object, a reference to an optional parent Entity, a kind (represented as an arbitrary string), and a set of zero or more typed properties.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String KEY_RESERVED_PROPERTY
      A reserved property name used to refer to the key of the entity.
      static java.lang.String SCATTER_RESERVED_PROPERTY
      A reserved property name used to refer to the scatter property of the entity.
      static java.lang.String VERSION_RESERVED_PROPERTY
      A reserved property name used to report an entity group's version.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Entity(Key key)
      Create a new Entity uniquely identified by the provided Key.
      Entity(java.lang.String kind)
      Create a new Entity with the specified kind and no parent Entity.
      Entity(java.lang.String kind, Key parent)
      Create a new Entity with the specified kind and parent Entity.
      Entity(java.lang.String kind, long id)
      Create a new Entity with the specified kind and ID and no parent Entity.
      Entity(java.lang.String kind, long id, Key parent)
      Create a new Entity with the specified kind and ID and parent Entity.
      Entity(java.lang.String kind, java.lang.String keyName)
      Create a new Entity with the specified kind and key name and no parent Entity.
      Entity(java.lang.String kind, java.lang.String keyName, Key parent)
      Create a new Entity with the specified kind, key name, and parent Entity.
    • Field Detail

      • KEY_RESERVED_PROPERTY

        public static final java.lang.String KEY_RESERVED_PROPERTY
        A reserved property name used to refer to the key of the entity. This string can be used for filtering and sorting by the entity key itself.
        See Also:
        Constant Field Values
      • SCATTER_RESERVED_PROPERTY

        public static final java.lang.String SCATTER_RESERVED_PROPERTY
        A reserved property name used to refer to the scatter property of the entity. Used for finding split points (e.g. for mapping over a kind).
        See Also:
        Constant Field Values
      • VERSION_RESERVED_PROPERTY

        public static final java.lang.String VERSION_RESERVED_PROPERTY
        A reserved property name used to report an entity group's version.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Entity

        public Entity(java.lang.String kind)
        Create a new Entity with the specified kind and no parent Entity. The instantiated Entity will have an incomplete Key when this constructor returns. The Key will remain incomplete until you put the Entity, after which time the Key will have its id set.
      • Entity

        public Entity(java.lang.String kind,
                      Key parent)
        Create a new Entity with the specified kind and parent Entity. The instantiated Entity will have an incomplete Key when this constructor returns. The Key will remain incomplete until you put the Entity, after which time the Key will have its id set.
      • Entity

        public Entity(java.lang.String kind,
                      java.lang.String keyName)
        Create a new Entity with the specified kind and key name and no parent Entity. The instantiated Entity will have a complete Key when this constructor returns. The Key's name field will be set to the value of keyName.

        This constructor is syntactic sugar for new Entity(KeyFactory.createKey(kind, keyName)).

      • Entity

        public Entity(java.lang.String kind,
                      long id)
        Create a new Entity with the specified kind and ID and no parent Entity. The instantiated Entity will have a complete Key when this constructor returns. The Key's id field will be set to the value of id.

        Creating an entity for the purpose of insertion (as opposed to update) with this constructor is discouraged unless the id was obtained from a key returned by a KeyRange obtained from AsyncDatastoreService.allocateIds(String, long) or DatastoreService.allocateIds(String, long) for the same kind.

        This constructor is syntactic sugar for new Entity(KeyFactory.createKey(kind, id)).

      • Entity

        public Entity(java.lang.String kind,