Class InputBuilder<T>
- java.lang.Object
-
- me.nemo_64.betterinputs.api.input.InputBuilder<T>
-
public final class InputBuilder<T> extends Object
-
-
Constructor Summary
Constructors Constructor Description InputBuilder(BetterInputs<?> api, Class<T> inputType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IPlatformActor<?>actor()Gets the wrapped owning actorInputBuilder<T>actor(Object actor)Sets the owning actor of this input processArgumentMapargumentMap()Gets the parameters for the input provider type creationBiConsumer<InputProvider<T>,String>cancelListener()Gets the currently set cancel listenerInputBuilder<T>cancelListener(BiConsumer<InputProvider<T>,String> cancelListener)Sets the cancel listener for this input processInputBuilder<T>clearParams()Deletes all parameters that were set for the input provider type creationConsumer<Throwable>exceptionHandler()Gets the currently set exception handlerInputBuilder<T>exceptionHandler(Consumer<Throwable> exceptionHandler)Sets the exception handler for this input processClass<T>inputType()Gets the input typeInputBuilder<T>param(String name, Object value)Sets a parameter for the input provider type creationInputBuilder<T>params(ArgumentMap map)Sets the parameters for the input provider type creationInputProvider<T>provide()Creates a new input provider based on this builderInputBuilder<T>removeParam(String name)Deletes a parameter for the input provider type creationStringtype()Gets the input provider type keyInputBuilder<T>type(String type)Sets the requested input provider type
-
-
-
Constructor Detail
-
InputBuilder
public InputBuilder(BetterInputs<?> api, Class<T> inputType)
-
-
Method Detail
-
type
public InputBuilder<T> type(String type)
Sets the requested input provider type- Parameters:
type- the input provider type key- Returns:
- the same builder
-
params
public InputBuilder<T> params(ArgumentMap map)
Sets the parameters for the input provider type creation- Parameters:
map- the parameters for the input provider type- Returns:
- the same builder
-
param
public InputBuilder<T> param(String name, Object value)
Sets a parameter for the input provider type creation- Parameters:
name- the name of the parametervalue- the value of the parameter- Returns:
- the same builder
-
removeParam
public InputBuilder<T> removeParam(String name)
Deletes a parameter for the input provider type creation- Parameters:
name- the name of the parameter that should be deleted- Returns:
- the same builder
-
clearParams
public InputBuilder<T> clearParams()
Deletes all parameters that were set for the input provider type creation- Returns:
- the same builder
-
actor
public InputBuilder<T> actor(Object actor)
Sets the owning actor of this input process- Parameters:
actor- the owning actor- Returns:
- the same builder
-
cancelListener
public InputBuilder<T> cancelListener(BiConsumer<InputProvider<T>,String> cancelListener)
Sets the cancel listener for this input process- Parameters:
cancelListener- the cancel listener- Returns:
- the same builder
-
exceptionHandler
public InputBuilder<T> exceptionHandler(Consumer<Throwable> exceptionHandler)
Sets the exception handler for this input process- Parameters:
exceptionHandler- the exception handler- Returns:
- the same builder
-
exceptionHandler
public Consumer<Throwable> exceptionHandler()
Gets the currently set exception handler- Returns:
- the exception handler
-
cancelListener
public BiConsumer<InputProvider<T>,String> cancelListener()
Gets the currently set cancel listener- Returns:
- the cancel listener
-
type
public String type()
Gets the input provider type key- Returns:
- the input provider type key
-
actor
public IPlatformActor<?> actor()
Gets the wrapped owning actor- Returns:
- the owning actor
-
argumentMap
public ArgumentMap argumentMap()
Gets the parameters for the input provider type creation- Returns:
- the parameters
-
provide
public InputProvider<T> provide() throws NullPointerException, IllegalArgumentException, NotEnoughArgumentsException
Creates a new input provider based on this builder- Returns:
- the new input provider
- Throws:
NullPointerException- if the set actor was invalid or wasn't set at allIllegalArgumentException- if there is no InputFactory with the set keyNotEnoughArgumentsException- if the provided parameters were not enough to create the requested input provider type
-
-