Package google.registry.persistence
Class VKey<T>
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.persistence.VKey<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class VKey<T> extends ImmutableObject implements java.io.Serializable
VKey is an abstraction that encapsulates the key concept.A VKey instance must contain the JPA primary key for the referenced entity class.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotHydrate, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
-
Field Summary
-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> VKey<T>
create(java.lang.Class<T> kind, java.io.Serializable key)
Creates aVKey
with supplied the SQL primary key.static <T extends EppResource>
VKey<T>createEppVKeyFromString(java.lang.String keyString)
Constructs aVKey
for anEppResource
from the string representation.java.io.Serializable
getKey()
Returns the primary key.java.lang.Class<? extends T>
getKind()
Returns the type of the entity.java.lang.String
stringify()
Constructs the string representation of aVKey
.java.lang.String
toString()
Constructs the readable string representation of aVKey
.-
Methods inherited from class google.registry.model.ImmutableObject
clone, cloneEmptyToNull, createVKey, equals, getSignificantFields, hashCode, toDiffableFieldMap, toHydratedString, toStringHelper
-
-
-
-
Method Detail
-
create
public static <T> VKey<T> create(java.lang.Class<T> kind, java.io.Serializable key)
Creates aVKey
with supplied the SQL primary key.
-
createEppVKeyFromString
public static <T extends EppResource> VKey<T> createEppVKeyFromString(java.lang.String keyString)
Constructs aVKey
for anEppResource
from the string representation.The string representation is obtained from the
stringify()
function and like this:kind:SomeEntity@sql:rO0ABXQAA2Zvbw
-
getKind
public java.lang.Class<? extends T> getKind()
Returns the type of the entity.
-
getKey
public java.io.Serializable getKey()
Returns the primary key.
-
stringify
public java.lang.String stringify()
Constructs the string representation of aVKey
.The string representation contains its kind and Base64 SQL key, in the following format:
kind:class_name@sql:encoded_sqlKey
.
-
toString
public java.lang.String toString()
Constructs the readable string representation of aVKey
.- Overrides:
toString
in classImmutableObject
-
-