Package kr.toxicity.model.api.tracker
Record Class TrackerAnimation<T extends Tracker>
java.lang.Object
java.lang.Record
kr.toxicity.model.api.tracker.TrackerAnimation<T>
- Type Parameters:
T- the type of tracker this animation applies to- Record Components:
name- the unique name of the animationpriority- the priority of the animation (higher values usually take precedence)targetClass- the class type of the trackerapplyCondition- a condition to check if the animation can be playedmodifierBuilder- a function that provides anAnimationModifierremoveTask- the task to run when the animation is removedsuccessTask- the task to run when the animation starts successfullyfallbackTask- the task to run when the animation fails to start
- All Implemented Interfaces:
Comparable<TrackerAnimation<T>>
public record TrackerAnimation<T extends Tracker>(@NotNull String name, int priority, @NotNull Class<T extends Tracker> targetClass, @NotNull Predicate<? super T extends Tracker> applyCondition, @NotNull Function<? super T extends Tracker,AnimationModifier> modifierBuilder, @NotNull Consumer<? super T extends Tracker> removeTask, @NotNull Consumer<? super T extends Tracker> successTask, @NotNull Consumer<? super T extends Tracker> fallbackTask)
extends Record
implements Comparable<TrackerAnimation<T>>
A record representing an animation configuration for a
Tracker.
This class defines how an animation should be applied, its priority, and the tasks to run during different lifecycle stages of the animation.
- Since:
- 2.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classTrackerAnimation.Builder<T extends Tracker>A builder class for creating instances ofTrackerAnimation. -
Constructor Summary
ConstructorsConstructorDescriptionTrackerAnimation(@NotNull String name, int priority, @NotNull Class<T> targetClass, @NotNull Predicate<? super T> applyCondition, @NotNull Function<? super T, AnimationModifier> modifierBuilder, @NotNull Consumer<? super T> removeTask, @NotNull Consumer<? super T> successTask, @NotNull Consumer<? super T> fallbackTask) Creates an instance of aTrackerAnimationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theapplyConditionrecord component.static @NotNull TrackerAnimation.Builder<Tracker> Creates a new builder for aTrackerAnimation.intcompareTo(@NonNull TrackerAnimation<T> o) final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefallbackTaskrecord component.final inthashCode()Returns a hash code value for this object.@NotNull Function<? super T, AnimationModifier> Returns the value of themodifierBuilderrecord component.@NotNull Stringname()Returns the value of thenamerecord component.intpriority()Returns the value of thepriorityrecord component.Returns the value of theremoveTaskrecord component.Returns the value of thesuccessTaskrecord component.Returns the value of thetargetClassrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TrackerAnimation
@Internal public TrackerAnimation(@NotNull @NotNull String name, int priority, @NotNull @NotNull Class<T> targetClass, @NotNull @NotNull Predicate<? super T> applyCondition, @NotNull @NotNull Function<? super T, AnimationModifier> modifierBuilder, @NotNull @NotNull Consumer<? super T> removeTask, @NotNull @NotNull Consumer<? super T> successTask, @NotNull @NotNull Consumer<? super T> fallbackTask) Creates an instance of aTrackerAnimationrecord class.- Parameters:
name- the value for thenamerecord componentpriority- the value for thepriorityrecord componenttargetClass- the value for thetargetClassrecord componentapplyCondition- the value for theapplyConditionrecord componentmodifierBuilder- the value for themodifierBuilderrecord componentremoveTask- the value for theremoveTaskrecord componentsuccessTask- the value for thesuccessTaskrecord componentfallbackTask- the value for thefallbackTaskrecord component
-
-
Method Details
-
builder
@NotNull public static @NotNull TrackerAnimation.Builder<Tracker> builder(@NotNull @NotNull String name) Creates a new builder for aTrackerAnimation.- Parameters:
name- the name of the animation- Returns:
- a new builder instance
- Since:
- 2.2.0
-
compareTo
- Specified by:
compareToin interfaceComparable<T extends Tracker>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
priority
public int priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
targetClass
Returns the value of thetargetClassrecord component.- Returns:
- the value of the
targetClassrecord component
-
applyCondition
Returns the value of theapplyConditionrecord component.- Returns:
- the value of the
applyConditionrecord component
-
modifierBuilder
Returns the value of themodifierBuilderrecord component.- Returns:
- the value of the
modifierBuilderrecord component
-
removeTask
Returns the value of theremoveTaskrecord component.- Returns:
- the value of the
removeTaskrecord component
-
successTask
Returns the value of thesuccessTaskrecord component.- Returns:
- the value of the
successTaskrecord component
-
fallbackTask
Returns the value of thefallbackTaskrecord component.- Returns:
- the value of the
fallbackTaskrecord component
-