Class 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)
      Convert src to object of type targetType recursively
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReflectHelper

        private ReflectHelper()
    • Method Detail

      • list2Array

        public static java.lang.Object list2Array​(java.lang.Class<?> targetType,
                                                  java.lang.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, this method 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