public final class JavetReflectionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getMethodNameFromLambda(java.io.Serializable lambda)
Gets method name from lambda.
|
static java.util.Set<java.lang.String> |
getMethodNameSetFromLambdas(java.io.Serializable... lambdas)
Gets method name set from lambdas.
|
static void |
safeSetAccessible(java.lang.reflect.AccessibleObject accessibleObject)
Safe set accessible.
|
public static java.lang.String getMethodNameFromLambda(java.io.Serializable lambda)
Usage:
Suppose there is a test() method.
public String test() { ... }Let's convert the lambda of test() to string which represents the method name.
String methodName = JavetReflectionUtils.getMethodNameFromLambda((Supplier & Serializable) this::test);
lambda
- the lambdapublic static java.util.Set<java.lang.String> getMethodNameSetFromLambdas(java.io.Serializable... lambdas)
Usage:
Suppose there are a few methods.
public String abc() { ... } public int def() { ... }Let's convert the lambda of these methods to a set which contains the method names.
Set<String> methodNameSet = JavetReflectionUtils.getMethodNameSetFromLambdas( (Supplier & Serializable) this::abc, (Supplier & Serializable) this::def);
lambdas
- the lambdaspublic static void safeSetAccessible(java.lang.reflect.AccessibleObject accessibleObject)
accessibleObject
- the accessible object