Package org.opensaml.storage
Class StorageRecord<Type>
java.lang.Object
org.opensaml.storage.StorageRecord<Type>
- Type Parameters:
Type
- the object type represented by the record
- Direct Known Subclasses:
MemcachedStorageRecord
,MutableStorageRecord
Represents a versioned record in a
StorageService
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the record expiration.getValue()
Get the record value.getValue
(StorageSerializer<Type> serializer, String context, String key) Get the record value, using a custom deserialization process.long
Get the record version.protected long
Increment the record version and returns the new value.protected void
setExpiration
(Long exp) Set the record expiration.protected void
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.
-
Field Details
-
version
private long versionVersion field. -
value
Value field. -
expiration
Expiration field.
-
-
Constructor Details
-
StorageRecord
Constructor.- Parameters:
val
- valueexp
- expiration, or null if none
-
-
Method Details
-
getVersion
public long getVersion()Get the record version.- Returns:
- the record version
-
getValue
Get the record value.- Returns:
- the record value
-
getValue
@Nonnull public Type getValue(@Nonnull StorageSerializer<Type> serializer, @Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key) throws IOException Get the record value, using a custom deserialization process.- Parameters:
serializer
- a custom (de)serialization process to applycontext
- context of recordkey
- key of record- Returns:
- the record value
- Throws:
IOException
- if deserialization fails
-
getExpiration
Get the record expiration.- Returns:
- the record expiration, or null if none
-
setVersion
protected void setVersion(long ver) Set the record version.- Parameters:
ver
- the new record version, must be > 0
-
setValue
Set the record value.- Parameters:
val
- the new record value
-
setValue
protected void setValue(@Nonnull Type instance, @Nonnull StorageSerializer<Type> serializer) throws IOException Set the record value, using a custom serialization process.- Parameters:
instance
- the new record valueserializer
- a custom serialization process to apply- Throws:
IOException
- if serialization fails
-
setExpiration
Set the record expiration.- Parameters:
exp
- the new record expiration, or null if none
-
incrementVersion
protected long incrementVersion()Increment the record version and returns the new value.- Returns:
- the updated version
-