Class Permission.Builder

java.lang.Object
eu.cloudnetservice.driver.permission.Permission.Builder
Enclosing class:
Permission

public static class Permission.Builder extends Object
A builder for a Permission.
Since:
4.0
  • Field Details

    • name

      private String name
    • potency

      private int potency
    • timeOutMillis

      private long timeOutMillis
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • name

      Sets the name of this permission.
      Parameters:
      name - the name of the permission.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given name is null.
    • potency

      @NonNull public @NonNull Permission.Builder potency(int potency)
      Sets the potency of this permission.
      Parameters:
      potency - the potency of this permission
      Returns:
      the same instance as used to call the method, for chaining.
    • timeOutMillis

      @NonNull public @NonNull Permission.Builder timeOutMillis(long timeOutMillis)
      Sets the given milliseconds to the absolute time at which this permission should expire.
      Parameters:
      timeOutMillis - the time-out for this permission.
      Returns:
      the same instance as used to call the method, for chaining.
    • timeOutMillis

      @NonNull public @NonNull Permission.Builder timeOutMillis(@NonNull @NonNull TimeUnit unit, long timeOut)
      Sets the given time-out to the absolute time at which this permission should expire. The time-out is added to the current time millis System.currentTimeMillis().
      Parameters:
      unit - the unit of the given time out.
      timeOut - the time-out for this permission.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given unit is null.
    • build

      @NonNull public @NonNull Permission build()
      Builds the new permission with all previously set options.
      Returns:
      the new permission.
      Throws:
      NullPointerException - if the name of the permission is missing.