Skip to content

Commit

Permalink
feat: allow for consumer interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Jan 26, 2024
1 parent 1dc8f2e commit 61f29b4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions state-core/src/main/java/org/incendo/state/StateInteraction.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.incendo.state;

import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.UnaryOperator;
import org.apiguardian.api.API;
Expand Down Expand Up @@ -116,6 +117,19 @@ private Builder(final @NonNull V instance) {
return this;
}

/**
* Sets the interaction.
*
* @param interaction interaction
* @return {@code this}
*/
public @This @NonNull Builder<U, V> consumer(final @NonNull Consumer<V> interaction) {
return this.interaction(stateful -> {
interaction.accept(stateful);
return stateful;
});
}

/**
* Builds the interaction.
*
Expand Down

0 comments on commit 61f29b4

Please sign in to comment.