java.lang.Object
net.sourceforge.argparse4j.helper.ReflectHelper
This class provides helper functions related to reflection.
The application code should not use this class directly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
list2Array
(Class<?> targetType, Object src) Convertsrc
to object of typetargetType
recursively
-
Constructor Details
-
ReflectHelper
private ReflectHelper()
-
-
Method Details
-
list2Array
Convert
src
to object of typetargetType
recursivelyConvert
src
to object of typetargetType
recursively, but it only convertsList
to array. IftargetType
is array type andsrc
isList
, new array is created with the size ofsrc
and for each element ofsrc
, this method will be called recursively with the component type oftargetType
and the element ofsrc
. The returned object is assigned to newly created array. If eithertargetType
is not array orsrc
is notList
, simply returnssrc
.- Parameters:
targetType
- The target typesrc
- The src object- Returns:
- The converted object
-