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 class
BaseEntity.Builder<K extends IncompleteKey,B extends BaseEntity.Builder<K,B>>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String name)
Returnstrue
if the entity contains a property with the givenname
.boolean
equals(Object obj)
Blob
getBlob(String name)
Returns the property value as a blob.boolean
getBoolean(String name)
Returns the property value as a boolean.double
getDouble(String name)
Returns the property value as a double.<K extends IncompleteKey>
FullEntity<K>getEntity(String name)
Returns the property value as an entity.K
getKey()
Returns the associated key or null if it does not have one.Key
getKey(String name)
Returns the property value as a Key.LatLng
getLatLng(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.long
getLong(String name)
Returns the property value as long.Set<String>
getNames()
Returns the properties name.Map<String,Value<?>>
getProperties()
Returns the properties.String
getString(String name)
Returns the property value as a string.com.google.cloud.Timestamp
getTimestamp(String name)
Returns the property value as a Timestamp.<V extends Value<?>>
VgetValue(String name)
Returns theValue
for the given propertyname
.int
hashCode()
boolean
hasKey()
Returns true if entity has a non-null key.boolean
isNull(String name)
Returns true if property is an instance of NullValue.String
toString()
-
-
-
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)
Returnstrue
if the entity contains a property with the givenname
.
-
getValue
public <V extends Value<?>> V getValue(String name)
Returns theValue
for 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
-
-