Class DatastoreNativeTypes

java.lang.Object
com.google.cloud.spring.data.datastore.core.convert.DatastoreNativeTypes

public abstract class DatastoreNativeTypes extends Object
A class to manage Datastore-specific simple type conversions.
Since:
1.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<Class<?>>
    The set of natively-supported Datastore types.
    static final org.springframework.data.mapping.model.SimpleTypeHolder
    A simple type holder that only contains the Cloud Datastore native data types.
    static final Set<Class<?>>
    The set of native ID types that Datastore supports.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    bindValueToGqlBuilder(com.google.cloud.datastore.GqlQuery.Builder builder, String tagName, Object val)
    Bind a given tag and value to a GQL query builder.
    static boolean
    Checks if a given type is a native type for Cloud Datastore.
    static com.google.cloud.datastore.Value
    wrapValue(Object propertyVal)
    Wraps Datastore native type to Datastore value type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DATASTORE_NATIVE_TYPES

      public static final Set<Class<?>> DATASTORE_NATIVE_TYPES
      The set of natively-supported Datastore types.
    • ID_TYPES

      public static final Set<Class<?>> ID_TYPES
      The set of native ID types that Datastore supports.
    • HOLDER

      public static final org.springframework.data.mapping.model.SimpleTypeHolder HOLDER
      A simple type holder that only contains the Cloud Datastore native data types.
  • Constructor Details

    • DatastoreNativeTypes

      public DatastoreNativeTypes()
  • Method Details

    • isNativeType

      public static boolean isNativeType(Class clazz)
      Checks if a given type is a native type for Cloud Datastore.
      Parameters:
      clazz - the class type to check
      Returns:
      `true` if the type is a native type, which includes `null`. `false` otherwise.
    • wrapValue

      public static com.google.cloud.datastore.Value wrapValue(Object propertyVal)
      Wraps Datastore native type to Datastore value type.
      Parameters:
      propertyVal - the property value to wrap
      Returns:
      the wrapped value
    • bindValueToGqlBuilder

      public static void bindValueToGqlBuilder(com.google.cloud.datastore.GqlQuery.Builder builder, String tagName, Object val)
      Bind a given tag and value to a GQL query builder.
      Parameters:
      builder - the builder holding a GQL query that is being built.
      tagName - the name of the tag to bind.
      val - the value to bind to the tag.