Package org.conscrypt.metrics
Class OptionalMethod
- java.lang.Object
-
- org.conscrypt.metrics.OptionalMethod
-
@Internal public final class OptionalMethod extends java.lang.Object
Helper class to handle reflexive loading and invocation of methods which may be absent.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.MethodcachedMethod
-
Constructor Summary
Constructors Constructor Description OptionalMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... methodParams)Instantiates a new OptionalMethod.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <T> TcheckNotNull(T reference)private static java.lang.reflect.MethodinitializeMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... methodParams)java.lang.Objectinvoke(java.lang.Object target, java.lang.Object... args)java.lang.ObjectinvokeStatic(java.lang.Object... args)
-
-
-
Constructor Detail
-
OptionalMethod
public OptionalMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... methodParams)Instantiates a new OptionalMethod.Does not throw any exceptions if the class or method can't be loaded, or if any parameter classes are
nulland instead behaves as a no-op, always returningnull.- Parameters:
clazz- the Class to search for methods onmethodName- the name of theMethodonclazzmethodParams- list ofClassesof theMethod'sparameters- Throws:
java.lang.NullPointerException- if the method name isnull
-
-
Method Detail
-
initializeMethod
private static java.lang.reflect.Method initializeMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... methodParams)
-
invokeStatic
public java.lang.Object invokeStatic(java.lang.Object... args)
-
invoke
public java.lang.Object invoke(java.lang.Object target, java.lang.Object... args)
-
checkNotNull
private static <T> T checkNotNull(T reference)
-
-