Type - the object type represented by the record@NotThreadSafe
public class StorageRecord<Type>
extends java.lang.Object
StorageService.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Long |
expiration
Expiration field.
|
private java.lang.String |
value
Value field.
|
private long |
version
Version field.
|
| Constructor and Description |
|---|
StorageRecord(java.lang.String val,
java.lang.Long exp)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Long |
getExpiration()
Get the record expiration.
|
java.lang.String |
getValue()
Get the record value.
|
Type |
getValue(StorageSerializer<Type> serializer,
java.lang.String context,
java.lang.String key)
Get the record value, using a custom deserialization process.
|
long |
getVersion()
Get the record version.
|
protected long |
incrementVersion()
Increment the record version and returns the new value.
|
protected void |
setExpiration(java.lang.Long exp)
Set the record expiration.
|
protected void |
setValue(java.lang.String val)
Set the record value.
|
protected void |
setValue(Type instance,
StorageSerializer<Type> serializer)
Set the record value, using a custom serialization process.
|
protected void |
setVersion(long ver)
Set the record version.
|
private long version
private java.lang.String value
private java.lang.Long expiration
public StorageRecord(@Nonnull @NotEmpty
java.lang.String val,
@Nullable
java.lang.Long exp)
val - valueexp - expiration, or null if nonepublic long getVersion()
@Nonnull public java.lang.String getValue()
@Nonnull public Type getValue(@Nonnull StorageSerializer<Type> serializer, @Nonnull @NotEmpty java.lang.String context, @Nonnull @NotEmpty java.lang.String key) throws java.io.IOException
serializer - a custom (de)serialization process to applycontext - context of recordkey - key of recordjava.io.IOException - if deserialization fails@Nullable public java.lang.Long getExpiration()
protected void setVersion(long ver)
ver - the new record version, must be > 0protected void setValue(@Nonnull @NotEmpty
java.lang.String val)
val - the new record valueprotected void setValue(@Nonnull
Type instance,
@Nonnull
StorageSerializer<Type> serializer)
throws java.io.IOException
instance - the new record valueserializer - a custom serialization process to applyjava.io.IOException - if serialization failsprotected void setExpiration(@Nullable
java.lang.Long exp)
exp - the new record expiration, or null if noneprotected long incrementVersion()