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 interfaceAGenericRunnablewith 0 arguments.static interfaceAGenericRunnablewith 1 argument.static interfaceAGenericRunnablewith 2 arguments.static interfaceAGenericRunnablewith 3 arguments.static interfaceAGenericRunnablewith 4 arguments. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcheckArgc(int count) Checks whethercountis the correct number of arguments for thisGenericRunnable.intReturns the number of arguments thisGenericRunnableaccepts.voidRuns thisGenericRunnable.
-
Method Details
-
run
Runs thisGenericRunnable.- Parameters:
args- The arguments- Throws:
IllegalArgumentException- If the number of elements inargsdoes not match the value returned bygetArgumentCount()Exception- Any exception thrown by the runnable
-
getArgumentCount
int getArgumentCount()Returns the number of arguments thisGenericRunnableaccepts.- Returns:
- The number of arguments
-
checkArgc
default void checkArgc(int count) Checks whethercountis the correct number of arguments for thisGenericRunnable.- Parameters:
count-- Throws:
IllegalArgumentException- Ifcountdoes not match the value returned bygetArgumentCount()
-