Interface GenericRunnable
- All Known Subinterfaces:
GenericRunnable.A0
,GenericRunnable.A1<A>
,GenericRunnable.A2<A,
,B> GenericRunnable.A3<A,
,B, C> GenericRunnable.A4<A,
B, C, D>
public interface GenericRunnable
Represents a runnable or method reference with any number of arguments with any type, allowed to throw any exception.
- Since:
- 2.10
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
AGenericRunnable
with 0 arguments.static interface
AGenericRunnable
with 1 argument.static interface
AGenericRunnable
with 2 arguments.static interface
AGenericRunnable
with 3 arguments.static interface
AGenericRunnable
with 4 arguments. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
checkArgc
(int count) Checks whethercount
is the correct number of arguments for thisGenericRunnable
.int
Returns the number of arguments thisGenericRunnable
accepts.void
Runs thisGenericRunnable
.
-
Method Details
-
run
Runs thisGenericRunnable
.- Parameters:
args
- The arguments- Throws:
IllegalArgumentException
- If the number of elements inargs
does not match the value returned bygetArgumentCount()
Exception
- Any exception thrown by the runnable
-
getArgumentCount
int getArgumentCount()Returns the number of arguments thisGenericRunnable
accepts.- Returns:
- The number of arguments
-
checkArgc
default void checkArgc(int count) Checks whethercount
is the correct number of arguments for thisGenericRunnable
.- Parameters:
count
-- Throws:
IllegalArgumentException
- Ifcount
does not match the value returned bygetArgumentCount()
-