Type
- the object type represented by the record@NotThreadSafe public class StorageRecord<Type> extends Object
StorageService
.Constructor and Description |
---|
StorageRecord(String val,
Long exp)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Long |
getExpiration()
Get the record expiration.
|
String |
getValue()
Get the record value.
|
Type |
getValue(StorageSerializer<Type> serializer,
String context,
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(Long exp)
Set the record expiration.
|
protected void |
setValue(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.
|
public long getVersion()
@Nonnull public Type getValue(@Nonnull StorageSerializer<Type> serializer, @Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key) throws IOException
serializer
- a custom (de)serialization process to applycontext
- context of recordkey
- key of recordIOException
- if deserialization fails@Nullable public Long getExpiration()
protected void setVersion(long ver)
ver
- the new record version, must be > 0protected void setValue(@Nonnull @NotEmpty String val)
val
- the new record valueprotected void setValue(@Nonnull Type instance, @Nonnull StorageSerializer<Type> serializer) throws IOException
instance
- the new record valueserializer
- a custom serialization process to applyIOException
- if serialization failsprotected void setExpiration(@Nullable Long exp)
exp
- the new record expiration, or null if noneprotected long incrementVersion()
Copyright © 2019. All rights reserved.