Class ReflectHelper

java.lang.Object
net.sourceforge.argparse4j.helper.ReflectHelper

public final class ReflectHelper extends Object

This class provides helper functions related to reflection.

The application code should not use this class directly.

  • Method Details

    • list2Array

      public static Object list2Array(Class<?> targetType, Object src)

      Convert src to object of type targetType recursively

      Convert src to object of type targetType recursively, but it only converts List to array. If targetType is array type and src is List, new array is created with the size of src and for each element of src, list2Array(Class, Object) will be called recursively with the component type of targetType and the element of src. The returned object is assigned to newly created array. If either targetType is not array or src is not List, simply returns src.

      Parameters:
      targetType - The target type
      src - The src object
      Returns:
      The converted object