Class ImmutableCooldown<C>

java.lang.Object
org.incendo.cloud.processors.cooldown.ImmutableCooldown<C>
All Implemented Interfaces:
Command.Builder.Applicable<C>, Cooldown<C>

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableCooldown<C> extends Object implements Cooldown<C>
Immutable implementation of Cooldown.

Use the builder to create immutable instances: ImmutableCooldown.builder(). Use the static factory method to create immutable instances: ImmutableCooldown.of().

  • Method Details

    • duration

      public @NonNull DurationFunction<C> duration()
      Returns the cooldown duration.
      Specified by:
      duration in interface Cooldown<C>
      Returns:
      the duration
    • group

      public @Nullable CooldownGroup group()
      Returns the group that this instance belongs to. If set to null then CooldownConfiguration.fallbackGroup() will be used.
      Specified by:
      group in interface Cooldown<C>
      Returns:
      the cooldown group
    • withDuration

      public final ImmutableCooldown<C> withDuration(@NonNull DurationFunction<C> value)
      Copy the current immutable object by setting a value for the duration attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for duration
      Returns:
      A modified copy of the this object
    • withGroup

      public final ImmutableCooldown<C> withGroup(@Nullable CooldownGroup value)
      Copy the current immutable object by setting a value for the group attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for group (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableCooldown that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: duration, group.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Cooldown with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static <C> ImmutableCooldown<C> of(@NonNull DurationFunction<C> duration, @Nullable CooldownGroup group)
      Construct a new immutable Cooldown instance.
      Type Parameters:
      C - generic parameter C
      Parameters:
      duration - The value for the duration attribute
      group - The value for the group attribute
      Returns:
      An immutable Cooldown instance
    • copyOf

      public static <C> ImmutableCooldown<C> copyOf(Cooldown<C> instance)
      Creates an immutable copy of a Cooldown value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      C - generic parameter C
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable Cooldown instance
    • builder

      public static <C> ImmutableCooldown.DurationBuildStage<C> builder()
      Creates a builder for ImmutableCooldown.
       ImmutableCooldown.&lt;C&gt;builder()
          .duration(org.incendo.cloud.processors.cooldown.@org.checkerframework.checker.nullness.qual.NonNull DurationFunction&lt;C&gt;) // required duration
          .group(org.incendo.cloud.processors.cooldown.@org.checkerframework.checker.nullness.qual.Nullable CooldownGroup | null) // nullable group
          .build();
       
      Type Parameters:
      C - generic parameter C
      Returns:
      A new ImmutableCooldown builder