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().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds instances of typeImmutableCooldown.static interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionstatic <C> ImmutableCooldown.DurationBuildStage<C>builder()Creates a builder forImmutableCooldown.static <C> ImmutableCooldown<C>Creates an immutable copy of aCooldownvalue.duration()Returns the cooldown duration.booleanThis instance is equal to all instances ofImmutableCooldownthat have equal attribute values.group()Returns the group that this instance belongs to.inthashCode()Computes a hash code from attributes:duration,group.static <C> ImmutableCooldown<C>of(@NonNull DurationFunction<C> duration, @Nullable CooldownGroup group) Construct a new immutableCooldowninstance.toString()Prints the immutable valueCooldownwith attribute values.final ImmutableCooldown<C>withDuration(@NonNull DurationFunction<C> value) Copy the current immutable object by setting a value for thedurationattribute.final ImmutableCooldown<C>withGroup(@Nullable CooldownGroup value) Copy the current immutable object by setting a value for thegroupattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.incendo.cloud.processors.cooldown.Cooldown
applyToCommandBuilder
-
Method Details
-
duration
Returns the cooldown duration. -
group
Returns the group that this instance belongs to. If set tonullthenCooldownConfiguration.fallbackGroup()will be used. -
withDuration
Copy the current immutable object by setting a value for thedurationattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for duration- Returns:
- A modified copy of the
thisobject
-
withGroup
Copy the current immutable object by setting a value for thegroupattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for group (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofImmutableCooldownthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:duration,group. -
toString
Prints the immutable valueCooldownwith attribute values. -
of
public static <C> ImmutableCooldown<C> of(@NonNull DurationFunction<C> duration, @Nullable CooldownGroup group) Construct a new immutableCooldowninstance.- Type Parameters:
C- generic parameter C- Parameters:
duration- The value for thedurationattributegroup- The value for thegroupattribute- Returns:
- An immutable Cooldown instance
-
copyOf
Creates an immutable copy of aCooldownvalue. 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
Creates a builder forImmutableCooldown.ImmutableCooldown.<C>builder() .duration(org.incendo.cloud.processors.cooldown.@org.checkerframework.checker.nullness.qual.NonNull DurationFunction<C>) // requiredduration.group(org.incendo.cloud.processors.cooldown.@org.checkerframework.checker.nullness.qual.Nullable CooldownGroup | null) // nullablegroup.build();- Type Parameters:
C- generic parameter C- Returns:
- A new ImmutableCooldown builder
-