Class Reflection
java.lang.Object
joptsimple.internal.Reflection
Helper methods for reflection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <V> ValueConverter<V> constructorConverter(Class<V> clazz) static <V> VconvertWith(ValueConverter<V> converter, String raw) static <V> ValueConverter<V> findConverter(Class<V> clazz) Finds an appropriate value converter for the given class.static <T> Tinstantiate(Constructor<T> constructor, Object... args) Invokes the given constructor with the given arguments.static ObjectInvokes the given static method with the given arguments.private static booleanmeetsConverterRequirements(Method method, Class<?> expectedReturnType) private static RuntimeExceptionprivate static <V> ValueConverter<V> valueOfConverter(Class<V> clazz)
-
Constructor Details
-
Reflection
private Reflection()
-
-
Method Details
-
findConverter
Finds an appropriate value converter for the given class.- Type Parameters:
V- a constraint on the class object to introspect- Parameters:
clazz- class to introspect on- Returns:
- a converter method or constructor
-
valueOfConverter
-
constructorConverter
-
instantiate
Invokes the given constructor with the given arguments.- Type Parameters:
T- constraint on the type of the objects yielded by the constructor- Parameters:
constructor- constructor to invokeargs- arguments to hand to the constructor- Returns:
- the result of invoking the constructor
- Throws:
ReflectionException- in lieu of the gaggle of reflection-related exceptions
-
invoke
Invokes the given static method with the given arguments.- Parameters:
method- method to invokeargs- arguments to hand to the method- Returns:
- the result of invoking the method
- Throws:
ReflectionException- in lieu of the gaggle of reflection-related exceptions
-
convertWith
-
meetsConverterRequirements
-
reflectionException
-