Package dev.morphia
Class Key<T>
- java.lang.Object
-
- dev.morphia.Key<T>
-
- Type Parameters:
T
- The type of the entity
- All Implemented Interfaces:
Serializable
,Comparable<Key<T>>
@Deprecated(since="2.0", forRemoval=true) public class Key<T> extends Object implements Serializable, Comparable<Key<T>>
Deprecated, for removal: This API element is subject to removal in a future version.The key object; this class is take from the app-engine datastore (mostly) implementation. It is also Serializable and GWT-safe, enabling your entity objects to be used for GWT RPC should you so desire.
You may use normal DBRef objects as relationships in your entities if you desire neither type safety nor GWT-ability.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Key()
Deprecated, for removal: This API element is subject to removal in a future version.For GWT serializationKey(Class<? extends T> type, String collection)
Deprecated, for removal: This API element is subject to removal in a future version.Create a key with an idKey(Class<? extends T> type, String collection, Object id)
Deprecated, for removal: This API element is subject to removal in a future version.Create a key with an id
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
compareTo(Key<T> other)
Deprecated, for removal: This API element is subject to removal in a future version.boolean
equals(Object obj)
Deprecated, for removal: This API element is subject to removal in a future version.String
getCollection()
Deprecated, for removal: This API element is subject to removal in a future version.Object
getId()
Deprecated, for removal: This API element is subject to removal in a future version.Class<? extends T>
getType()
Deprecated, for removal: This API element is subject to removal in a future version.int
hashCode()
Deprecated, for removal: This API element is subject to removal in a future version.void
setCollection(String collection)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the collection name.void
setType(Class<? extends T> clazz)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the type of the entity for this KeyString
toString()
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
-
Constructor Detail
-
Key
protected Key()
Deprecated, for removal: This API element is subject to removal in a future version.For GWT serialization
-
Key
public Key(Class<? extends T> type, @Nullable String collection, Object id)
Deprecated, for removal: This API element is subject to removal in a future version.Create a key with an id- Parameters:
type
- the type of the entitycollection
- the collection in which the entity livesid
- the value of the entity's ID
-
-
Method Detail
-
compareTo
public int compareTo(Key<T> other)
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
compareTo
in interfaceComparable<T>
-
getCollection
@Nullable public String getCollection()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the collection name.
-
setCollection
public void setCollection(@Nullable String collection)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the collection name.- Parameters:
collection
- the collection to use
-
getId
public Object getId()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- the id associated with this key.
-
getType
@Nullable public Class<? extends T> getType()
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- type of the entity
-
setType
public void setType(Class<? extends T> clazz)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the type of the entity for this Key- Parameters:
clazz
- the type to use
-
hashCode
public int hashCode()
Deprecated, for removal: This API element is subject to removal in a future version.
-
equals
public boolean equals(Object obj)
Deprecated, for removal: This API element is subject to removal in a future version.
-
-