Class Entities


  • public final class Entities
    extends Object
    Utility functions and constants for entities.
    • Field Detail

      • KIND_METADATA_KIND

        public static final 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 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 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 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
    • Constructor Detail

      • Entities

        public Entities()
    • Method Detail

      • createKindKey

        public static Key createKindKey​(String kind)
        Create a __kind__ key for kind.
        Parameters:
        kind - Kind to create key for.
        Returns:
        __kind__ key.
      • createPropertyKey

        public static Key createPropertyKey​(String kind,
                                            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​(String namespace)
        Create a __namespace__ key for namespace.
        Parameters:
        namespace - Namespace to create key for.
        Returns:
        __namespace__ key.
      • getNamespaceFromNamespaceKey

        public static @Nullable 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.