Class Lease
java.lang.Object
org.springframework.vault.core.lease.domain.Lease
A lease abstracting the lease Id, duration and its renewability.
- Author:
- Mark Paluch, Steven Swor
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static Lease
fromTimeToLive
(Duration leaseDuration) Create a new non-renewableLease
, without aleaseId
and specified duration.int
hashCode()
boolean
boolean
static Lease
none()
Factory method to return a non-renewable, zero-durationLease
.static Lease
Create a newLease
.toString()
-
Method Details
-
of
Create a newLease
.- Parameters:
leaseId
- must not be empty or null.leaseDuration
- the lease duration, must not be null or negative.renewable
- true if this lease is renewable.- Returns:
- the created
Lease
- Since:
- 2.0
-
fromTimeToLive
Create a new non-renewableLease
, without aleaseId
and specified duration.- Parameters:
leaseDuration
- the lease duration, must not be null or negative.- Returns:
- the created
Lease
- Since:
- 2.0
-
none
Factory method to return a non-renewable, zero-durationLease
.- Returns:
- a non-renewable, zero-duration
Lease
.
-
hasLeaseId
public boolean hasLeaseId()- Returns:
- true is the lease is associated with a
leaseId
. - Since:
- 1.1
-
getLeaseId
- Returns:
- the lease Id
-
getLeaseDuration
- Returns:
- the lease duration in seconds.
-
isRenewable
public boolean isRenewable()- Returns:
- true if the lease is renewable.
-
equals
-
hashCode
public int hashCode() -
toString
-