|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.appengine.api.datastore.Entity
public final class Entity
Entity is the fundamental unit of data storage. It has an
immutable identifier (contained in the Key) object, a
reference to an optional parent Entity, a kind (represented
as an arbitrary string), and a set of zero or more typed
properties.
| Field Summary | |
|---|---|
static java.lang.String |
KEY_RESERVED_PROPERTY
A reserved property name used to refer to the key of the entity. |
| Constructor Summary | |
|---|---|
Entity(java.lang.String kind)
Create a new Entity with the specified kind and no
parent Entity. |
|
Entity(java.lang.String kind,
Key parent)
Create a new Entity with the specified kind and parent
Entity. |
|
Entity(java.lang.String kind,
java.lang.String keyName)
Create a new Entity with the specified kind and key name and no
parent Entity. |
|
Entity(java.lang.String kind,
java.lang.String keyName,
Key parent)
Create a new Entity with the specified kind, key name, and
parent Entity. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object object)
Two Entity objects are considered equal if they refer to
the same entity (i.e. |
java.lang.String |
getAppId()
Returns the identifier of the application that owns this Entity. |
Key |
getKey()
Returns the Key that represents this Entity. |
java.lang.String |
getKind()
Returns a logical type that is associated with this Entity. |
Key |
getParent()
Get a Key that corresponds to this the parent Entity of this Entity. |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Gets all of the properties belonging to this Entity. |
java.lang.Object |
getProperty(java.lang.String propertyName)
Gets the property with the specified name. |
int |
hashCode()
|
boolean |
hasProperty(java.lang.String propertyName)
Returns true if a property has been set. |
void |
removeProperty(java.lang.String propertyName)
Removes any property with the specified name. |
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Sets the property named, propertyName, to value. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String KEY_RESERVED_PROPERTY
| Constructor Detail |
|---|
public Entity(java.lang.String kind)
Entity with the specified kind and no
parent Entity. The instantiated Entity will have an
incomplete Key when this constructor returns. The
Key will remain incomplete until you put the Entity,
after which time the Key will have its id set.
public Entity(java.lang.String kind,
Key parent)
Entity with the specified kind and parent
Entity. The instantiated Entity will have an
incomplete Key when this constructor returns. The
Key will remain incomplete until you put the Entity,
after which time the Key will have its id set.
public Entity(java.lang.String kind,
java.lang.String keyName)
Entity with the specified kind and key name and no
parent Entity. The instantiated Entity will have a
complete Key when this constructor returns. The
Key's name field will be set to the value of
keyName.
public Entity(java.lang.String kind,
java.lang.String keyName,
Key parent)
Entity with the specified kind, key name, and
parent Entity. The instantiated Entity will have a
complete Key when this constructor returns. The
Key's name field will be set to the value of
keyName.
| Method Detail |
|---|
public boolean equals(java.lang.Object object)
Entity objects are considered equal if they refer to
the same entity (i.e. their Key objects match).
equals in class java.lang.Objectpublic Key getKey()
Key that represents this Entity. If
the entity has not yet been saved (e.g. via DatastoreService.put), this Key will not be fully
specified and cannot be used for certain operations (like DatastoreService.get). Once the Entity has been saved,
its Key will be updated to be fully specified.
public java.lang.String getKind()
Entity. This is simply a convenience method that forwards to
the Key for this Entity.
public Key getParent()
Key that corresponds to this the parent Entity of this Entity. This is simply a convenience
method that forwards to the Key for this Entity.
public java.lang.Object getProperty(java.lang.String propertyName)
setProperty(java.lang.String, java.lang.Object).
propertyName.public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Entity.
Map of properties.public int hashCode()
hashCode in class java.lang.Objectpublic boolean hasProperty(java.lang.String propertyName)
null.
propertyName exists.public void removeProperty(java.lang.String propertyName)
java.lang.NullPointerException - If propertyName is null.
public void setProperty(java.lang.String propertyName,
java.lang.Object value)
propertyName, to value.
As the value is stored in the datastore, it is converted to the
datastore's native type. This may include widening, such as
converting a Short to a Long.
All Collections are prone
to losing their sort order and their original types as they are
stored in the datastore. For example, a TreeSet may be
returned as a List from getProperty(java.lang.String), with an
arbitrary re-ordering of elements.
value - may be one of the supported datatypes, or a heterogenous
Collection of one of the supported datatypes.
java.lang.IllegalArgumentException - If the value is not of a type that
the data store supports.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getAppId()
Entity. This is simply a convenience method that forwards to
the Key for this Entity.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||