Package org.conscrypt.metrics
Class OptionalMethod
java.lang.Object
org.conscrypt.metrics.OptionalMethod
Helper class to handle reflexive loading and invocation of methods which may be absent.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOptionalMethod(Class<?> clazz, String methodName, Class<?>... methodParams) Instantiates a new OptionalMethod. -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> TcheckNotNull(T reference) private static MethodinitializeMethod(Class<?> clazz, String methodName, Class<?>... methodParams) invokeStatic(Object... args)
-
Field Details
-
cachedMethod
-
-
Constructor Details
-
OptionalMethod
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:
NullPointerException- if the method name isnull
-
-
Method Details
-
initializeMethod
-
invokeStatic
-
invoke
-
checkNotNull
private static <T> T checkNotNull(T reference)
-