Package org.incendo.cloud
Interface SenderMapper<B,M>
- Type Parameters:
B
- base command sender typeM
- mapped command sender type
Mapper than can transform command senders from a base type to another type and back.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <B,
M> @NonNull SenderMapper <B, M> create
(@NonNull Function<@NonNull B, @NonNull M> map, @NonNull Function<@NonNull M, @NonNull B> reverse) Creates a new sender mapper from the provided functions.static <S> @NonNull SenderMapper
<S, S> identity()
Returns the identity mapper, a mapper that does not transform the sender.Maps a command sender to another type.Reverses a mapped command sender to it's base type.
-
Method Details
-
map
Maps a command sender to another type.- Parameters:
base
- base command sender- Returns:
- mapped command sender
-
reverse
Reverses a mapped command sender to it's base type.- Parameters:
mapped
- mapped command sender- Returns:
- base command sender
-
create
static <B,M> @NonNull SenderMapper<B,M> create(@NonNull Function<@NonNull B, @NonNull M> map, @NonNull Function<@NonNull M, @NonNull B> reverse) Creates a new sender mapper from the provided functions.- Type Parameters:
B
- base command sender typeM
- mapped command sender type- Parameters:
map
- mapping functionreverse
- reverse mapping function- Returns:
- new sender mapper
-
identity
Returns the identity mapper, a mapper that does not transform the sender.- Type Parameters:
S
- base and mapped command sender type- Returns:
- identity mapper
-