com.google.appengine.api.datastore
Class DataTypeUtils
- java.lang.Object
-
- com.google.appengine.api.datastore.DataTypeUtils
-
public final class DataTypeUtils extends java.lang.ObjectDataTypeUtilspresents 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 notStringBuffer),- All numeric primitive wrappers (
BytethroughLong,FloatandDouble, but notBigIntegerorBigDecimal. Key, for storing references to otherEntityobjects.User, for storing references to users.ShortBlob, for storing binary data small enough to be indexed. This means properties of this type, unlikeBlobproperties, 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.
-
-
Field Summary
Fields Modifier and Type Field and Description static intMAX_LINK_PROPERTY_LENGTHstatic intMAX_SHORT_BLOB_PROPERTY_LENGTHThis is the maximum number of bytes that aShortBlobproperty can contain.static intMAX_STRING_PROPERTY_LENGTHThis is the maximum number of bytes that a string property can contain.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidcheckSupportedValue(java.lang.Object value)If the specified object cannot be used as the value for aEntityproperty, throw an exception with the appropriate explanation.static voidcheckSupportedValue(java.lang.String name, java.lang.Object value)If the specified object cannot be used as the value for aEntityproperty, throw an exception with the appropriate explanation.static java.util.Set<java.lang.Class<?>>getSupportedTypes()Returns an unmodifiableSetof supportedClassobjects.static booleanisSupportedType(java.lang.Class<?> clazz)Returns true if and only if the suppliedClasscan be stored in the data store.static booleanisUnindexableType(java.lang.Class<?> clazz)Returns true if the suppliedClasscannot be indexed.
-
-
-
Field Detail
-
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 aText.- See Also:
- Constant Field Values
-
MAX_SHORT_BLOB_PROPERTY_LENGTH
public static final int MAX_SHORT_BLOB_PROPERTY_LENGTH
This is the maximum number of bytes that aShortBlobproperty can contain. If your data is larger, you need to use aBlob.- See Also:
- Constant Field Values
-
MAX_LINK_PROPERTY_LENGTH
public static final int MAX_LINK_PROPERTY_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkSupportedValue
public static void checkSupportedValue(java.lang.Object value)
If the specified object cannot be used as the value for aEntityproperty, throw an exception with the appropriate explanation.- Throws:
java.lang.NullPointerException- if the specified value is nulljava.lang.IllegalArgumentException- if the type is not supported, or if the object is in some other way invalid.
-
checkSupportedValue
public static void checkSupportedValue(java.lang.String name, java.lang.Object value)If the specified object cannot be used as the value for aEntityproperty, throw an exception with the appropriate explanation.- Throws:
java.lang.NullPointerException- if the specified value is nulljava.lang.IllegalArgumentException- if the type is not supported, or if the object is in some other way invalid.
-
isSupportedType
public static boolean isSupportedType(java.lang.Class<?> clazz)
Returns true if and only if the suppliedClasscan be stored in the data store.
-
getSupportedTypes
public static java.util.Set<java.lang.Class<?>> getSupportedTypes()
Returns an unmodifiableSetof supportedClassobjects.
-
isUnindexableType
public static boolean isUnindexableType(java.lang.Class<?> clazz)
Returns true if the suppliedClasscannot be indexed.
-
-