Package io.dialob.executor.command
Class ImmutableStaticTrigger<T>
- java.lang.Object
-
- io.dialob.executor.command.ImmutableStaticTrigger<T>
-
- All Implemented Interfaces:
StaticTrigger<T>,Trigger<T>,Serializable
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableStaticTrigger<T> extends Object implements StaticTrigger<T>
Immutable implementation ofStaticTrigger.Use the builder to create immutable instances:
ImmutableStaticTrigger.builder(). Use the static factory method to create immutable instances:ImmutableStaticTrigger.of().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableStaticTrigger.Builder<T>Builds instances of typeImmutableStaticTrigger.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ImmutableStaticTrigger.Builder<T>builder()Creates a builder forImmutableStaticTrigger.static <T> ImmutableStaticTrigger<T>copyOf(StaticTrigger<T> instance)Creates an immutable copy of aStaticTriggervalue.booleanequals(Object another)This instance is equal to all instances ofImmutableStaticTriggerthat have equal attribute values.com.google.common.collect.ImmutableList<Event>getAllEvents()BiPredicate<T,T>getWhen()inthashCode()Computes a hash code from attributes:when,allEvents.static <T> ImmutableStaticTrigger<T>of(BiPredicate<T,T> when)Construct a new immutableStaticTriggerinstance.StringtoString()Prints the immutable valueStaticTriggerwith attribute values.ImmutableStaticTrigger<T>withAllEvents(Event... elements)Copy the current immutable object with elements that replace the content ofallEvents.ImmutableStaticTrigger<T>withAllEvents(Iterable<? extends Event> elements)Copy the current immutable object with elements that replace the content ofallEvents.ImmutableStaticTrigger<T>withWhen(BiPredicate<T,T> value)Copy the current immutable object by setting a value for thewhenattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.dialob.executor.command.Trigger
apply, createEvent
-
-
-
-
Method Detail
-
getWhen
public BiPredicate<T,T> getWhen()
-
getAllEvents
public com.google.common.collect.ImmutableList<Event> getAllEvents()
- Specified by:
getAllEventsin interfaceTrigger<T>- Returns:
- The value of the
allEventsattribute
-
withWhen
public final ImmutableStaticTrigger<T> withWhen(BiPredicate<T,T> value)
Copy the current immutable object by setting a value for thewhenattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for when- Returns:
- A modified copy of the
thisobject
-
withAllEvents
public final ImmutableStaticTrigger<T> withAllEvents(Event... elements)
Copy the current immutable object with elements that replace the content ofallEvents.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withAllEvents
public final ImmutableStaticTrigger<T> withAllEvents(Iterable<? extends Event> elements)
Copy the current immutable object with elements that replace the content ofallEvents. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of allEvents elements to set- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableStaticTriggerthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:when,allEvents.
-
toString
public String toString()
Prints the immutable valueStaticTriggerwith attribute values.
-
of
public static <T> ImmutableStaticTrigger<T> of(BiPredicate<T,T> when)
Construct a new immutableStaticTriggerinstance.- Type Parameters:
T- generic parameter T- Parameters:
when- The value for thewhenattribute- Returns:
- An immutable StaticTrigger instance
-
copyOf
public static <T> ImmutableStaticTrigger<T> copyOf(StaticTrigger<T> instance)
Creates an immutable copy of aStaticTriggervalue. 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 StaticTrigger instance
-
builder
public static <T> ImmutableStaticTrigger.Builder<T> builder()
Creates a builder forImmutableStaticTrigger.ImmutableStaticTrigger.<T>builder() .when(function.BiPredicate<T, T>) // requiredwhen.addAllEvents|addAllAllEvents(io.dialob.executor.command.event.Event) //allEventselements .build();- Type Parameters:
T- generic parameter T- Returns:
- A new ImmutableStaticTrigger builder
-
-