Package com.google.cloud.datastore
Class BaseEntity<K extends IncompleteKey>
- java.lang.Object
-
- com.google.cloud.datastore.BaseEntity<K>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FullEntity,ProjectionEntity
public abstract class BaseEntity<K extends IncompleteKey> extends Object implements Serializable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseEntity.Builder<K extends IncompleteKey,B extends BaseEntity.Builder<K,B>>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(String name)Returnstrueif the entity contains a property with the givenname.booleanequals(Object obj)BlobgetBlob(String name)Returns the property value as a blob.booleangetBoolean(String name)Returns the property value as a boolean.doublegetDouble(String name)Returns the property value as a double.<K extends IncompleteKey>
FullEntity<K>getEntity(String name)Returns the property value as an entity.KgetKey()Returns the associated key or null if it does not have one.KeygetKey(String name)Returns the property value as a Key.LatLnggetLatLng(String name)Returns the property value as a LatLng.<T extends Value<?>>
List<T>getList(String name)Returns the property value as a list of values.longgetLong(String name)Returns the property value as long.Set<String>getNames()Returns the properties name.Map<String,Value<?>>getProperties()Returns the properties.StringgetString(String name)Returns the property value as a string.com.google.cloud.TimestampgetTimestamp(String name)Returns the property value as a Timestamp.<V extends Value<?>>
VgetValue(String name)Returns theValuefor the given propertyname.inthashCode()booleanhasKey()Returns true if entity has a non-null key.booleanisNull(String name)Returns true if property is an instance of NullValue.StringtoString()
-
-
-
Method Detail
-
hasKey
public boolean hasKey()
Returns true if entity has a non-null key.
-
getKey
public K getKey()
Returns the associated key or null if it does not have one.
-
contains
public boolean contains(String name)
Returnstrueif the entity contains a property with the givenname.
-
getValue
public <V extends Value<?>> V getValue(String name)
Returns theValuefor the given propertyname.- Throws:
DatastoreException- if no such property
-
isNull
public boolean isNull(String name)
Returns true if property is an instance of NullValue.- Throws:
DatastoreException- if no such property
-
getString
public String getString(String name)
Returns the property value as a string.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a string
-
getLong
public long getLong(String name)
Returns the property value as long.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a long
-
getDouble
public double getDouble(String name)
Returns the property value as a double.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a double
-
getBoolean
public boolean getBoolean(String name)
Returns the property value as a boolean.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a boolean
-
getTimestamp
public com.google.cloud.Timestamp getTimestamp(String name)
Returns the property value as a Timestamp.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a Timestamp
-
getLatLng
public LatLng getLatLng(String name)
Returns the property value as a LatLng.- Throws:
DatastoreException- if no such property.ClassCastException- if value is not a LatLng.
-
getKey
public Key getKey(String name)
Returns the property value as a Key.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a Key
-
getEntity
public <K extends IncompleteKey> FullEntity<K> getEntity(String name)
Returns the property value as an entity.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not an entity
-
getList
public <T extends Value<?>> List<T> getList(String name)
Returns the property value as a list of values.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a list of values
-
getBlob
public Blob getBlob(String name)
Returns the property value as a blob.- Throws:
DatastoreException- if no such propertyClassCastException- if value is not a blob
-
-