java.lang.Object
org.springframework.vault.core.lease.domain.Lease

public class Lease extends Object
A lease abstracting the lease Id, duration and its renewability.
Author:
Mark Paluch, Steven Swor
  • Method Details

    • of

      public static Lease of(String leaseId, Duration leaseDuration, boolean renewable)
      Create a new Lease.
      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

      public static Lease fromTimeToLive(Duration leaseDuration)
      Create a new non-renewable Lease, without a leaseId and specified duration.
      Parameters:
      leaseDuration - the lease duration, must not be null or negative.
      Returns:
      the created Lease
      Since:
      2.0
    • none

      public static Lease none()
      Factory method to return a non-renewable, zero-duration Lease.
      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

      @Nullable public String getLeaseId()
      Returns:
      the lease Id
    • getLeaseDuration

      public Duration getLeaseDuration()
      Returns:
      the lease duration in seconds.
    • isRenewable

      public boolean isRenewable()
      Returns:
      true if the lease is renewable.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object