Modifier and Type | Class and Description |
---|---|
static interface |
Action.Function
A functional interface for the containing delegate type.
|
Constructor and Description |
---|
Action()
Creates a new instance of this delegate.
|
Action(Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke a static method on a class.
|
Action(Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Initializes a delegate that will invoke an instance method on a class instance.
|
Modifier and Type | Method and Description |
---|---|
static Action |
combine(Action a,
Action b)
Combines two delegate instances, forming a new delegate that will invoke both
delegates when invoked.
|
abstract void |
invoke()
Represents a method that takes no parameters and does not return a value.
|
static Action |
of(Action.Function f)
Create a delegate for the given interface.
|
static Action |
of(Action.Function f,
Class<?> targetClass,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
static Action |
of(Action.Function f,
Object targetObject,
String methodName,
Class<?>... methodParameterClasses)
Create a delegate for the given interface.
|
static Action |
remove(Action source,
Action value)
Removes one delegate from another, if it was previously combined.
|
void |
run()
When an object implementing interface
Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
public Action()
public Action(@Nonnull Object targetObject, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
targetObject
- The class instance on which the delegate will invoke the method.methodName
- The name of the instance method.methodParameterClasses
- The type of the parameters of the instance method.public Action(@Nonnull Class<?> targetClass, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
targetClass
- The class that defines the method.methodName
- The name of the static method.methodParameterClasses
- The type of the parameters of the static method.public abstract void invoke()
public final void run()
java.lang.Runnable
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
The general contract of the method run
is that it may
take any action whatsoever.
run
in interface Runnable
Thread.run()
@Nullable public static Action combine(@Nullable Action a, @Nullable Action b)
a
- The delegate which will be invoked first.b
- The delegate which will be invoked last.@Nullable public static Action remove(@Nullable Action source, @Nullable Action value)
source
- The delegate from which to remove value.value
- The delegate to remove from source.@Nonnull public static Action of(@Nonnull Action.Function f)
f
- The function which will be invoked.@Nonnull public static Action of(@Nonnull Action.Function f, @Nonnull Object targetObject, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
f
- The function which will be invoked.targetObject
- The class instance on which the delegate will invoke the method.methodName
- The name of the instance method.methodParameterClasses
- The type of the parameters of the instance method.@Nonnull public static Action of(@Nonnull Action.Function f, @Nonnull Class<?> targetClass, @Nonnull String methodName, @Nonnull Class<?>... methodParameterClasses)
f
- The function which will be invoked.targetClass
- The class that defines the method.methodName
- The name of the static method.methodParameterClasses
- The type of the parameters of the static method.