public class ConvertUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
convert(Object value,
Class<T> targetType)
Converts an input value to a target type.
|
static <T> T |
convert(Object value,
Class<T> targetType,
Object instance)
Converts an input value to a target type.
|
static String |
convertToJS(String snippet)
Process a Javascript code snippet.
|
static Object |
invokeMethod(Object instance,
Method method,
Object... args)
Invokes a method with the provided value(s), performing type conversion as necessary.
|
static List<OptionMap> |
toOptionMaps(Collection<? extends OptionMap.IOptionMapConverter> items)
Converts a collection of IOptionMapConverter items to a list of maps.
|
public static <T> T convert(Object value, Class<T> targetType)
T - The target type.value - The value to convert.targetType - The type to which to convert.public static <T> T convert(Object value, Class<T> targetType, Object instance)
T - The target type.value - The value to convert.targetType - The type to which to convert.instance - The object instance whose property value is to be set (necessary when the
target type is a component and the value is the component name or id).public static String convertToJS(String snippet)
snippet - JS code snippet.public static List<OptionMap> toOptionMaps(Collection<? extends OptionMap.IOptionMapConverter> items)
items - IOptionMapConverter items to convert.public static Object invokeMethod(Object instance, Method method, Object... args)
instance - Instance that is the target of the invocation (may be null for static
methods).method - The method to invoke.args - Arguments to be passed to method (may be null if no arguments). Argument values
will be coerced to the expected type if possible.Copyright © 2017 Regenstrief Center for Biomedical Informatics. All rights reserved.