Class DataTypeUtils (2.0.0)

public final class DataTypeUtils

DataTypeUtils presents a simpler interface that allows user-code to determine what Classes can safely be stored as properties in the data store.

Currently this list includes:

  • String (but not StringBuffer),
  • All numeric primitive wrappers (Byte through Long, Float and Double, but not java.math.BigInteger or java.math.BigDecimal.
  • Key, for storing references to other Entity objects.
  • User, for storing references to users.
  • ShortBlob, for storing binary data small enough to be indexed. This means properties of this type, unlike Blob properties, can be filtered and sorted on in queries.
  • Blob, for storing unindexed binary data less than 1MB.
  • Text, for storing unindexed String data less than 1MB.
  • BlobKey, for storing references to user uploaded blobs (which may exceed 1MB).
  • Date.
  • Link.

Inheritance

Object > DataTypeUtils

Static Fields

public static final int MAX_LINK_PROPERTY_LENGTH
Field Value
TypeDescription
int

MAX_SHORT_BLOB_PROPERTY_LENGTH

public static final int MAX_SHORT_BLOB_PROPERTY_LENGTH

This is the maximum number of bytes that a ShortBlob property can contain. If your data is larger, you need to use a Blob.

Field Value
TypeDescription
int

MAX_STRING_PROPERTY_LENGTH

public static final int MAX_STRING_PROPERTY_LENGTH

This is the maximum number of bytes that a string property can contain. If your string has more bytes, you need to wrap it in a Text.

Field Value
TypeDescription
int

Static Methods

checkSupportedValue(@Nullable String name, @Nullable Object value)

public static void checkSupportedValue(@Nullable String name, @Nullable Object value)

If the specified object cannot be used as the value for a Entity property, throw an exception with the appropriate explanation.

Parameters
NameDescription
name@org.checkerframework.checker.nullness.qual.Nullable java.lang.String
value@org.checkerframework.checker.nullness.qual.Nullable java.lang.Object

checkSupportedValue(Object value)

public static void checkSupportedValue(Object value)

If the specified object cannot be used as the value for a Entity property, throw an exception with the appropriate explanation.

Parameter
NameDescription
valueObject

getSupportedTypes()

public static Set<Class<?>> getSupportedTypes()

Returns an unmodifiable Set of supported Class objects.

Returns
TypeDescription
Set<Class<?>>

isSupportedType(Class<?> clazz)

public static boolean isSupportedType(Class<?> clazz)

Returns true if and only if the supplied Class can be stored in the data store.

Parameter
NameDescription
clazzClass<?>
Returns
TypeDescription
boolean

isUnindexableType(Class<?> clazz)

public static boolean isUnindexableType(Class<?> clazz)

Returns true if the supplied Class cannot be indexed.

Parameter
NameDescription
clazzClass<?>
Returns
TypeDescription
boolean