Class ImmutableDynamicTrigger<T>

  • All Implemented Interfaces:
    DynamicTrigger<T>, Trigger<T>, Serializable

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableDynamicTrigger<T>
    extends Object
    implements DynamicTrigger<T>
    Immutable implementation of DynamicTrigger.

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

    See Also:
    Serialized Form
    • Method Detail

      • withWhen

        public final ImmutableDynamicTrigger<T> withWhen​(BiPredicate<T,​T> value)
        Copy the current immutable object by setting a value for the when attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for when
        Returns:
        A modified copy of the this object
      • withEventsProvider

        public final ImmutableDynamicTrigger<T> withEventsProvider​(Triggers.EventsProvider<T> value)
        Copy the current immutable object by setting a value for the eventsProvider attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for eventsProvider
        Returns:
        A modified copy of the this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableDynamicTrigger 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: when, eventsProvider.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

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

        public static <T> ImmutableDynamicTrigger<T> of​(BiPredicate<T,​T> when,
                                                        Triggers.EventsProvider<T> eventsProvider)
        Construct a new immutable DynamicTrigger instance.
        Type Parameters:
        T - generic parameter T
        Parameters:
        when - The value for the when attribute
        eventsProvider - The value for the eventsProvider attribute
        Returns:
        An immutable DynamicTrigger instance
      • copyOf

        public static <T> ImmutableDynamicTrigger<T> copyOf​(DynamicTrigger<T> instance)
        Creates an immutable copy of a DynamicTrigger 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:
        T - generic parameter T
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable DynamicTrigger instance
      • builder

        public static <T> ImmutableDynamicTrigger.Builder<T> builder()
        Creates a builder for ImmutableDynamicTrigger.
         ImmutableDynamicTrigger.&lt;T&gt;builder()
            .when(function.BiPredicate&lt;T, T&gt;) // required when
            .eventsProvider(io.dialob.executor.command.Triggers.EventsProvider&lt;T&gt;) // required eventsProvider
            .build();
         
        Type Parameters:
        T - generic parameter T
        Returns:
        A new ImmutableDynamicTrigger builder