Package io.microsphere.reflect
Class ExecutableUtils
- java.lang.Object
-
- io.microsphere.util.BaseUtils
-
- io.microsphere.reflect.ExecutableUtils
-
-
Constructor Summary
Constructors Constructor Description ExecutableUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E extends java.lang.reflect.Executable & java.lang.reflect.Member>
voidexecute(E object, ThrowableConsumer<E> callback)
Execute anExecutable
instancestatic <E extends java.lang.reflect.Executable & java.lang.reflect.Member,R>
Rexecute(E executableMember, ThrowableFunction<E,R> callback)
Execute anExecutable
instancestatic <E extends java.lang.reflect.Executable & java.lang.reflect.Member,R>
Rexecute(E executable, ThrowableSupplier<R> supplier)
Executes theExecutable
-
-
-
Method Detail
-
execute
public static <E extends java.lang.reflect.Executable & java.lang.reflect.Member> void execute(E object, ThrowableConsumer<E> callback) throws java.lang.NullPointerException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, java.lang.RuntimeException
Execute anExecutable
instance- Type Parameters:
E
- The type or subtype ofExecutable
- Parameters:
object
-Executable
instance,Field
,Method
orConstructor
callback
- the call back to executeExecutable
object- Throws:
java.lang.NullPointerException
- IfexecutableMember
isnull
java.lang.IllegalStateException
- if thisexecutableMember
object is enforcing Java language access control and the underlying executable member is inaccessible.java.lang.IllegalArgumentException
- if the executable member is an instance executable member and the specified object argument is not an instance of the class or interface declaring the underlying executable member (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a executable member invocation conversion.java.lang.RuntimeException
- if the underlying executable member throws an exception.
-
execute
public static <E extends java.lang.reflect.Executable & java.lang.reflect.Member,R> R execute(E executable, ThrowableSupplier<R> supplier) throws java.lang.NullPointerException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, java.lang.RuntimeException
Executes theExecutable
- Parameters:
executable
-Executable
supplier
-ThrowableConsumer
- Throws:
java.lang.NullPointerException
- IfexecutableMember
isnull
java.lang.IllegalStateException
- if thisexecutableMember
object is enforcing Java language access control and the underlying executable member is inaccessible.java.lang.IllegalArgumentException
- if the executable member is an instance executable member and the specified object argument is not an instance of the class or interface declaring the underlying executable member (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a executable member invocation conversion.java.lang.RuntimeException
- if the underlying executable member throws an exception.
-
execute
public static <E extends java.lang.reflect.Executable & java.lang.reflect.Member,R> R execute(E executableMember, ThrowableFunction<E,R> callback) throws java.lang.NullPointerException, java.lang.IllegalStateException, java.lang.IllegalArgumentException, java.lang.RuntimeException
Execute anExecutable
instance- Type Parameters:
E
- The type or subtype ofExecutable
R
- The type of execution result- Parameters:
executableMember
-Executable
Member
,Method
orConstructor
callback
- the call back to executeExecutable
Member
- Returns:
- The execution result
- Throws:
java.lang.NullPointerException
- IfexecutableMember
isnull
java.lang.IllegalStateException
- if thisexecutableMember
object is enforcing Java language access control and the underlying executable member is inaccessible.java.lang.IllegalArgumentException
- if the executable member is an instance executable member and the specified object argument is not an instance of the class or interface declaring the underlying executable member (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a executable member invocation conversion.java.lang.RuntimeException
- if the underlying executable member throws an exception.
-
-