Package me.hsgamer.hscore.request
Class FunctionRequestManager<T,V>
java.lang.Object
me.hsgamer.hscore.request.FunctionRequestManager<T,V>
- Type Parameters:
T- the type of the argumentV- the type of the return value
A simple request manager with return values
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequest(@NotNull UUID uuid, @NotNull BiFunction<UUID, T, V> function) Add a requestvoidaddRequest(@NotNull UUID uuid, @NotNull Function<T, V> function) Add a requestApply a requestbooleanCheck if a unique id is in the request cachevoidRemove a request
-
Constructor Details
-
FunctionRequestManager
public FunctionRequestManager()
-
-
Method Details
-
addRequest
public void addRequest(@NotNull @NotNull UUID uuid, @NotNull @NotNull BiFunction<UUID, T, V> function) Add a request- Parameters:
uuid- the unique idfunction- the function when the request is called
-
addRequest
Add a request- Parameters:
uuid- the unique idfunction- the function when the request is called
-
apply
Apply a request- Parameters:
uuid- the unique idarg- the argument- Returns:
- the return value from the function
-
remove
Remove a request- Parameters:
uuid- the unique id
-
contains
Check if a unique id is in the request cache- Parameters:
uuid- the unique id- Returns:
- whether it's in the request cache
-