Android APIs
public final class

Entity

extends Object
implements SafeParcelable
java.lang.Object
   ↳ com.google.android.gms.cloudsave.Entity

Class Overview

CloudSave object representing an entity on the backend.

Summary

Nested Classes
class Entity.Key A key that maps to a particular Entity instance. 
Constants
int TYPE_BOOLEAN
int TYPE_BYTE_ARRAY
int TYPE_DOUBLE
int TYPE_LIST
int TYPE_LONG
int TYPE_NULL
int TYPE_STRING
int TYPE_UNKNOWN
[Expand]
Inherited Constants
From interface android.os.Parcelable
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
Fields
public static final EntityCreator CREATOR
Public Constructors
Entity(Entity.Key key)
Public Methods
void clear()
Clears all properties.
int describeContents()
boolean equals(Object object)
Check if the provided entity is equivalent to the current one.
Entity.Key getKey()
Returns the Entity.Key assigned to this Entity.
boolean getPropertyAsBoolean(String name, boolean defaultValue)
Get the value of property with the given name or defaultValue if the property does not exist.
byte[] getPropertyAsByteArray(String name, byte[] defaultValue)
Get the value of property with the given name or defaultValue if the property does not exist.
double getPropertyAsDouble(String name, double defaultValue)
Get the value of property with the given name or defaultValue if the property does not exist.
List<?> getPropertyAsList(String name, List<?> defaultValue)
Get the value of property with the given name or defaultValue if the property does not exist.
long getPropertyAsLong(String name, long defaultValue)
Get the value of property with the given name or defaultValue if the property does not exist.
String getPropertyAsString(String name, String defaultValue)
Get the value of property with the given name or defaultValue if the property does not exist.
Set<String> getPropertyNames()
Returns the set of names of all properties in this Entity.
boolean hasProperty(String name)
Returns true if there is a property with the given name.
int hashCode()
boolean isEmpty()
Returns true if there are no properties in this Entity.
void remove(String name)
Removes the property with the specified name.
Entity setProperty(String name, long value)
Sets the property with the given name to the specified value.
Entity setProperty(String name, double value)
Sets the property with the given name to the specified value.
Entity setProperty(String name, boolean value)
Sets the property with the given name to the specified value.
Entity setProperty(String name, List<?> value)
Sets the property with the given name to the specified list value.
Entity setProperty(String name)
Sets the property with the given name to the 'null' value.
Entity setProperty(String name, byte[] value)
Sets the property with the given name to the specified value.
Entity setProperty(String name, String value)
Sets the property with the given name to the specified value.
int size()
The number of properties present in the Entity.
int valueType(String name)
Returns the type of the value for the property with the given name.
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int TYPE_BOOLEAN

Constant Value: 4 (0x00000004)

public static final int TYPE_BYTE_ARRAY

Constant Value: 6 (0x00000006)

public static final int TYPE_DOUBLE

Constant Value: 3 (0x00000003)

public static final int TYPE_LIST

Constant Value: 7 (0x00000007)

public static final int TYPE_LONG

Constant Value: 2 (0x00000002)

public static final int TYPE_NULL

Constant Value: 1 (0x00000001)

public static final int TYPE_STRING

Constant Value: 5 (0x00000005)

public static final int TYPE_UNKNOWN

Constant Value: 0 (0x00000000)

Fields

public static final EntityCreator CREATOR

Public Constructors

public Entity (Entity.Key key)

Public Methods

public void clear ()

Clears all properties.

public int describeContents ()

public boolean equals (Object object)

Check if the provided entity is equivalent to the current one. Two entities are equivalent if the following conditions are met: - Both entities have the same key - Both entities have the same number of properties - For every property in an entity there is an equivalent property in the other entity with the same property name, type and value. List values are equivalent if they have the same elements (both type and value) in the same order - Ordering of the properties within the entities doesn't matter

Parameters
object The entity to compare the current entity to
Returns
  • boolean true if the provided entity is equivalent to the current entity, false otherwise.

public Entity.Key getKey ()

Returns the Entity.Key assigned to this Entity.

public boolean getPropertyAsBoolean (String name, boolean defaultValue)

Get the value of property with the given name or defaultValue if the property does not exist.

public byte[] getPropertyAsByteArray (String name, byte[] defaultValue)

Get the value of property with the given name or defaultValue if the property does not exist.

public double getPropertyAsDouble (String name, double defaultValue)

Get the value of property with the given name or defaultValue if the property does not exist.

public List<?> getPropertyAsList (String name, List<?> defaultValue)

Get the value of property with the given name or defaultValue if the property does not exist.

public long getPropertyAsLong (String name, long defaultValue)

Get the value of property with the given name or defaultValue if the property does not exist.

public String getPropertyAsString (String name, String defaultValue)

Get the value of property with the given name or defaultValue if the property does not exist.

public Set<String> getPropertyNames ()

Returns the set of names of all properties in this Entity.

public boolean hasProperty (String name)

Returns true if there is a property with the given name.

public int hashCode ()

public boolean isEmpty ()

Returns true if there are no properties in this Entity.

public void remove (String name)

Removes the property with the specified name.

Parameters
name name identifying the property to be removed

public Entity setProperty (String name, long value)

Sets the property with the given name to the specified value. Overrides any existing value for this property.

public Entity setProperty (String name, double value)

Sets the property with the given name to the specified value. Overrides any existing value for this property.

public Entity setProperty (String name, boolean value)

Sets the property with the given name to the specified value. Overrides any existing value for this property.

public Entity setProperty (String name, List<?> value)

Sets the property with the given name to the specified list value. Overrides any existing value for this property.

public Entity setProperty (String name)

Sets the property with the given name to the 'null' value. Overrides any existing value for this property.

public Entity setProperty (String name, byte[] value)

Sets the property with the given name to the specified value. Overrides any existing value for this property.

public Entity setProperty (String name, String value)

Sets the property with the given name to the specified value. Overrides any existing value for this property.

public int size ()

The number of properties present in the Entity.

public int valueType (String name)

Returns the type of the value for the property with the given name.

public void writeToParcel (Parcel dest, int flags)