com.google.appengine.api.datastore
Class Entities

java.lang.Object
  extended by com.google.appengine.api.datastore.Entities

public final class Entities
extends java.lang.Object

Utility functions and constants for entities.


Field Summary
static long ENTITY_GROUP_METADATA_ID
          ID for __entity_group__ entities.
static java.lang.String ENTITY_GROUP_METADATA_KIND
          A metadata kind that can be used to get information about entity groups.
static java.lang.String KIND_METADATA_KIND
          A metadata kind that can be used to query for kinds that exist in the datastore.
static long NAMESPACE_METADATA_EMPTY_ID
          The numeric ID for __namespace__ keys representing the empty namespace.
static java.lang.String NAMESPACE_METADATA_KIND
          A metadata kind that can be used to query for namespaces that exist in the datastore.
static java.lang.String PROPERTY_METADATA_KIND
          A metadata kind that can be used to query for properties that exist in the datastore.
 
Constructor Summary
Entities()
           
 
Method Summary
static Key createEntityGroupKey(Key key)
          Create an __entity_group__ key for the entity group containing key.
static Key createKindKey(java.lang.String kind)
          Create a __kind__ key for kind.
static Key createNamespaceKey(java.lang.String namespace)
          Create a __namespace__ key for namespace.
static Key createPropertyKey(java.lang.String kind, java.lang.String property)
          Create a __property__ key for property of kind.
static java.lang.String getNamespaceFromNamespaceKey(Key namespaceKey)
          Extract the namespace name from a __namespace__ key.
static long getVersionProperty(Entity entity)
          Get the value of the __version__ property from entity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KIND_METADATA_KIND

public static final java.lang.String KIND_METADATA_KIND
A metadata kind that can be used to query for kinds that exist in the datastore.

See Also:
Constant Field Values

PROPERTY_METADATA_KIND

public static final java.lang.String PROPERTY_METADATA_KIND
A metadata kind that can be used to query for properties that exist in the datastore.

See Also:
Constant Field Values

NAMESPACE_METADATA_KIND

public static final java.lang.String NAMESPACE_METADATA_KIND
A metadata kind that can be used to query for namespaces that exist in the datastore.

See Also:
Constant Field Values

NAMESPACE_METADATA_EMPTY_ID

public static final long NAMESPACE_METADATA_EMPTY_ID
The numeric ID for __namespace__ keys representing the empty namespace.

See Also:
Constant Field Values

ENTITY_GROUP_METADATA_KIND

public static final java.lang.String ENTITY_GROUP_METADATA_KIND
A metadata kind that can be used to get information about entity groups. The metadata for the entity group with root entity key R is fetched using a DatastoreService.get(com.google.appengine.api.datastore.Key) call on key KeyFactory.createKey(R, ENTITY_GROUP_METADATA_KIND, ENTITY_GROUP_METADATA_ID).

The resulting entity has a Entity.VERSION_RESERVED_PROPERTY numeric property whose value is guaranteed to increase on every change to the entity group. This value may also occasionally increase without any user-visible change to the entity group.

See Also:
Constant Field Values

ENTITY_GROUP_METADATA_ID

public static final long ENTITY_GROUP_METADATA_ID
ID for __entity_group__ entities.

See Also:
ENTITY_GROUP_METADATA_KIND, Constant Field Values
Constructor Detail

Entities

public Entities()
Method Detail

createKindKey

public static Key createKindKey(java.lang.String kind)
Create a __kind__ key for kind.

Parameters:
kind - Kind to create key for.
Returns:
__kind__ key.

createPropertyKey

public static Key createPropertyKey(java.lang.String kind,
                                    java.lang.String property)
Create a __property__ key for property of kind.

Parameters:
kind - Kind to create key for.
property - Property to create key for.
Returns:
__property__ key.

createNamespaceKey

public static Key createNamespaceKey(java.lang.String namespace)
Create a __namespace__ key for namespace.

Parameters:
namespace - Namespace to create key for.
Returns:
__namespace__ key.

getNamespaceFromNamespaceKey

public static java.lang.String getNamespaceFromNamespaceKey(Key namespaceKey)
Extract the namespace name from a __namespace__ key.

Parameters:
namespaceKey - Key to extract namespace from.
Returns:
The namespace name.

createEntityGroupKey

public static Key createEntityGroupKey(Key key)
Create an __entity_group__ key for the entity group containing key.

Parameters:
key - Key of any entity in the entity group.
Returns:
__entity_group__ key.

getVersionProperty

public static long getVersionProperty(Entity entity)
Get the value of the __version__ property from entity.

Parameters:
entity - Entity to fetch __version__ from (must have a numeric __version__ property).
Returns:
__version__ property value.