- java.lang.Object
-
- net.sourceforge.argparse4j.helper.ReflectHelper
-
public final class ReflectHelper extends java.lang.Object
This class provides helper functions related to reflection.
The application code should not use this class directly.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ReflectHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
list2Array(java.lang.Class<?> targetType, java.lang.Object src)
Convertsrc
to object of typetargetType
recursively
-
-
-
Method Detail
-
list2Array
public static java.lang.Object list2Array(java.lang.Class<?> targetType, java.lang.Object src)
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
-
-