public class Versioned<T> extends Object
Versioned.Version
metadata. A versioned
object can hold various states to represent:
create(Object)
create(Object, Version)
Versioned.Metadata
attached
create(Object, Metadata)
Versioned.Version
,
Versioned.Metadata
Modifier and Type | Class and Description |
---|---|
static class |
Versioned.Metadata
Value object representing version metadata such as creation/deletion time.
|
static class |
Versioned.Version
Value object representing a Vault version.
|
Modifier and Type | Method and Description |
---|---|
static <T> Versioned<T> |
create(T secret)
Create a
unversioned given secret. |
static <T> Versioned<T> |
create(T secret,
Versioned.Metadata metadata)
Create a versioned secret object given
secret and Versioned.Metadata . |
static <T> Versioned<T> |
create(T secret,
Versioned.Version version)
Create a versioned secret object given
secret and Versioned.Version . |
boolean |
equals(Object o) |
T |
getData() |
Versioned.Metadata |
getMetadata() |
T |
getRequiredData()
Returns the required data for this versioned object.
|
Versioned.Metadata |
getRequiredMetadata()
Returns the required
Versioned.Metadata for this versioned object. |
Versioned.Version |
getVersion() |
boolean |
hasData() |
int |
hashCode() |
boolean |
hasMetadata() |
Optional<T> |
toOptional()
Convert the data element of this versioned object to an
Optional . |
public static <T> Versioned<T> create(T secret)
unversioned
given secret.secret
- must not be null.Versioned
object for secret
public static <T> Versioned<T> create(@Nullable T secret, Versioned.Version version)
secret
and Versioned.Version
.
Versioned secret may contain no actual data as they can be in a deleted/destroyed
state.secret
- can be null.version
- must not be null.Versioned
object for secret
and Version
.public static <T> Versioned<T> create(@Nullable T secret, Versioned.Metadata metadata)
secret
and Versioned.Metadata
.
Versioned secret may contain no actual data as they can be in a deleted/destroyed
state.secret
- can be null.metadata
- must not be null.Versioned
object for secret
and Versioned.Metadata
.public Versioned.Version getVersion()
Versioned.Version
associated with this Versioned
object.public boolean hasMetadata()
Versioned.Metadata
associated,
otherwise false
@Nullable public Versioned.Metadata getMetadata()
public Versioned.Metadata getRequiredMetadata()
Versioned.Metadata
for this versioned object. Throws
IllegalStateException
if no metadata is associated.Versioned.Metadata
held by this for this versioned object.IllegalStateException
- if no metadata is present.public boolean hasData()
false
, of the version is deleted or destroyed.@Nullable public T getData()
public T getRequiredData()
IllegalStateException
if no data is associated.IllegalStateException
- if no data is present.public Optional<T> toOptional()
Optional
.Optional
holding the actual value of this
versioned object if data is present
, Optional.empty()
if
no data is associated.Copyright © 2016–2019 Pivotal Software, Inc.. All rights reserved.