Package com.oracle.bmc.util.internal
Class ReflectionUtils
- java.lang.Object
-
- com.oracle.bmc.util.internal.ReflectionUtils
-
public class ReflectionUtils extends Object
Various utility functions to simplify reflection use cases.This is primarily meant to be used with "safe" classes such that there shouldn't be a need to use AccessController to do priviledged actions.
-
-
Constructor Summary
Constructors Constructor Description ReflectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectinvokeGetter(Object instance, String methodName)Invokes a ‘getter’ method of the given name on the given instance.static booleanisClassPresent(String className, Class context)Checks if a class is present on the classpath
-
-
-
Method Detail
-
invokeGetter
public static Object invokeGetter(Object instance, String methodName)
Invokes a ‘getter’ method of the given name on the given instance.The method is assumed to be a basic getter with no parameters. If no method exists, or there is a problem invoking the method, null will be returned.
- Parameters:
instance- The instance to invoke the method on.methodName- The method name, if it exists.- Returns:
- The return value of the method call, or null.
-
isClassPresent
public static boolean isClassPresent(String className, Class context)
Checks if a class is present on the classpath- Parameters:
className- The name of the class to check the presence ofcontext- The method name, if it exists.- Returns:
- The boolean value indicating the presence of the class
-
-