public final class ReflectHelper extends Object
This class provides helper functions related to reflection.
The application code should not use this class directly.
Modifier and Type | Method and Description |
---|---|
static Object |
list2Array(Class<?> targetType,
Object src)
Convert
src to object of type targetType recursively |
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
,
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
.
targetType
- The target typesrc
- The src objectCopyright © 2012–2017. All rights reserved.