public final class EmbeddedEntity extends PropertyContainer
A property value containing embedded entity properties (and optionally a Key).
This class is similar to Entity, but differs in the following ways:
- #equals(Object) and #hashCode() compare the embedded properties in addition to the Key.
- It is not queryable when stored in the datastore.
- A Key is optional.
- Keys without a name or id are considered equal if all other aspects of the keys are equal (as they will not be assigned IDs by the datastore when embedded).
To convert from an Entity use:
EmbeddedEntity sv = new EmbeddedEntity();
sv.setKey(entity.getKey())
sv.setPropertiesFrom(entity)
To convert to an Entity use:
Entity entity = new Entity(sv.getKey())
entity.setPropertiesFrom(sv);
Constructors
EmbeddedEntity()
public EmbeddedEntity()
Methods
clone()
public EmbeddedEntity clone()
Returns | |
---|---|
Type | Description |
EmbeddedEntity |
equals(@Nullable Object obj)
public boolean equals(@Nullable Object obj)
Parameter | |
---|---|
Name | Description |
obj |
@org.checkerframework.checker.nullness.qual.Nullable java.lang.Object |
Returns | |
---|---|
Type | Description |
boolean |
getKey()
public @Nullable Key getKey()
Returns the key or null
.
Returns | |
---|---|
Type | Description |
@org.checkerframework.checker.nullness.qual.Nullable com.google.appengine.api.datastore.Key |
hashCode()
public int hashCode()
Returns | |
---|---|
Type | Description |
int |
setKey(@Nullable Key key)
public void setKey(@Nullable Key key)
Parameter | |
---|---|
Name | Description |
key |
@org.checkerframework.checker.nullness.qual.Nullable com.google.appengine.api.datastore.Key the key to set |
toString()
public String toString()
Returns | |
---|---|
Type | Description |
String |