Package org.rostore.client
Class VersionedObject<K,V>
java.lang.Object
org.rostore.client.VersionedObject<K,V>
- Type Parameters:
K
- key object typeV
- value object type
Versioned object, containing the object itself, and metadata: ttl information and version
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> VersionedObject <K, V> Creates a versioned object (general case)static <K,
V1, V2>
VersionedObject<K, V2> createDeserialized
(VersionedObject<K, V1> original, V2 value) static <K,
V> VersionedObject <K, V> createEternal
(K key, V object, Long version) Creates an eternal versioned objectstatic <K,
V> VersionedObject <K, V> createNewVersioned
(K key, V value, Long unixEol) Creates first version of the entity with the expiration timestampstatic <K,
V> VersionedObject <K, V> createNewVersionedEternal
(K key, V value) Creates first version of eternal objectstatic <K,
V> VersionedObject <K, V> createUnversionedEternal
(K key, V value) Creates an eternal unversioned objectgetKey()
Returns the key's objectGet the Class of the objectlong
getValue()
Get the valueGet the object's version.boolean
Gets is the object versioned or nottoString()
-
Method Details
-
createEternal
Creates an eternal versioned object- Type Parameters:
K
- type of the keyV
- type of the value- Parameters:
key
- the key objectobject
- the value objectversion
- the version of the entry- Returns:
- entity
-
createUnversionedEternal
Creates an eternal unversioned object- Type Parameters:
K
- type of the keyV
- type of the value- Parameters:
key
- the key objectvalue
- the value object- Returns:
- entity
-
createNewVersionedEternal
Creates first version of eternal object- Type Parameters:
K
- type of the keyV
- type of the value- Parameters:
key
- the key objectvalue
- the value object- Returns:
- entity
-
createNewVersioned
Creates first version of the entity with the expiration timestamp- Type Parameters:
K
- type of the keyV
- type of the value- Parameters:
key
- the key objectvalue
- the value objectunixEol
- the unix epoch's end of entity's life- Returns:
- entity
-
create
Creates a versioned object (general case)- Type Parameters:
K
- type of the keyV
- type of the value- Parameters:
key
- the key objectvalue
- the value objectversion
- the version of the entryunixEol
- the unix epoch's end of entity's life- Returns:
- entity
-
createDeserialized
public static <K,V1, VersionedObject<K,V2> V2> createDeserialized(VersionedObject<K, V1> original, V2 value) -
getUnixEOL
public long getUnixEOL()- Returns:
- 0 if object is eternal, otherwise millisecond counter when to expire
-
getKey
Returns the key's object- Returns:
- the key
-
getObjectClass
Get the Class of the object- Returns:
- object's class
-
getVersion
Get the object's version.If unversioned returns
Utils.VERSION_UNDEFINED
- Returns:
-
isVersioned
public boolean isVersioned()Gets is the object versioned or not- Returns:
true
if the object versioned,false
otherwise
-
getValue
Get the value- Returns:
- the object
-
toString
-