|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.appengine.api.datastore.PropertyContainer
com.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. |
static java.lang.String |
SCATTER_RESERVED_PROPERTY
A reserved property name used to refer to the scatter property of the entity. |
static java.lang.String |
VERSION_RESERVED_PROPERTY
A reserved property name used to report an entity group's version. |
| Constructor Summary | |
|---|---|
Entity(Key key)
Create a new Entity uniquely identified by the provided
Key. |
|
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,
long id)
Create a new Entity with the specified kind and ID and no
parent Entity. |
|
Entity(java.lang.String kind,
long id,
Key parent)
Create a new Entity with the specified kind and ID 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 | |
|---|---|
Entity |
clone()
Returns a shallow copy of this Entity instance. |
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. |
java.lang.String |
getNamespace()
Returns the namespace of the application/namespace that owns this Entity. |
Key |
getParent()
Get a Key that corresponds to this the parent Entity of this Entity. |
int |
hashCode()
|
void |
setPropertiesFrom(Entity src)
|
java.lang.String |
toString()
|
| Methods inherited from class com.google.appengine.api.datastore.PropertyContainer |
|---|
getProperties, getProperty, hasProperty, isUnindexedProperty, removeProperty, setPropertiesFrom, setProperty, setUnindexedProperty |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String KEY_RESERVED_PROPERTY
public static final java.lang.String SCATTER_RESERVED_PROPERTY
public static final java.lang.String VERSION_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.
This constructor is syntactic sugar for
new Entity(KeyFactory.createKey(kind, keyName)).
public Entity(java.lang.String kind,
long id)
Entity with the specified kind and ID and no
parent Entity. The instantiated Entity will have a
complete Key when this constructor returns. The
Key's id field will be set to the value of
id.
Creating an entity for the purpose of insertion (as opposed to
update) with this constructor is discouraged unless the id was
obtained from a key returned by a KeyRange obtained from
AsyncDatastoreService.allocateIds(String, long) or
DatastoreService.allocateIds(String, long) for the same
kind.
This constructor is syntactic sugar for
new Entity(KeyFactory.createKey(kind, id)).
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.
This constructor is syntactic sugar for
new Entity(KeyFactory.createKey(parent, kind, keyName)).
public Entity(java.lang.String kind,
long id,
Key parent)
Entity with the specified kind and ID and
parent Entity. The instantiated Entity will have a
complete Key when this constructor returns. The
Key's id field will be set to the value of
id.
Creating an entity for the purpose of insertion (as opposed to
update) with this constructor is discouraged unless the id was
obtained from a key returned by a KeyRange obtained from
AsyncDatastoreService.allocateIds(Key, String, long) or
DatastoreService.allocateIds(Key, String, long) for the same
parent and kind.
This constructor is syntactic sugar for
new Entity(KeyFactory.createKey(parent, kind, id)).
public Entity(Key key)
Entity uniquely identified by the provided
Key. Creating an entity for the purpose of insertion (as opposed
to update) with a key that has its id field set is strongly
discouraged unless the key was returned by a KeyRange.
KeyRange| 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 int hashCode()
hashCode in class java.lang.Objectpublic 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.
public java.lang.String getNamespace()
Entity. This is simply a convenience method that forwards to
the Key for this Entity.
public Entity clone()
Entity instance. Collection
properties are cloned as an ArrayList, the type returned from the
datastore. Instances of mutable datastore types are cloned as well.
Instances of all other types are reused.
Entitypublic void setPropertiesFrom(Entity src)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||