public class InjectionUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static char |
PREFIX_SEPARATOR
The character used to separate the prefix from the value name when you
are using the getObject method with a prefix.
|
| Constructor and Description |
|---|
InjectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
beanToMap(Object bean,
Map<String,String> map) |
static boolean |
checkPrimitives(Class target,
Class<? extends Object> source) |
static Field |
findFieldToInject(Class<? extends Object> target,
String name,
Class<? extends Object> source) |
static Method |
findMethodToGet(Class<? extends Object> target,
String name) |
static Method |
findMethodToInject(Class<? extends Object> target,
String name,
Class source) |
static Field |
getField(Class<? extends Object> target,
String name) |
static Field |
getField(Object target,
String name) |
static void |
getObject(Object target,
Input input,
Locale loc,
boolean tryField,
String prefix,
boolean tryToConvert,
boolean convertBoolean,
boolean allowRecursion) |
static Object |
getPrimitiveBlankValue(Class klass) |
static Class |
getPrimitiveFrom(Class klass) |
static Class |
getPrimitiveFrom(Object w) |
static String |
getProperty(Object bean,
String nameProperty)
Extract the value of a property of a bean!
|
static Object |
getValueToInject(String name,
Input input,
String prefix) |
static boolean |
hasDefaultConstructor(Class<? extends Object> klass) |
static boolean |
hasValueToInject(String name,
Input input,
String prefix) |
static boolean |
inject(Method m,
Object target,
Object value,
Locale loc,
boolean tryToConvert,
boolean tryingToConvertBoolean) |
static void |
prepareForInjection(Class<? extends Object> klass,
Map<String,Object> setters,
Map<String,Object> fields) |
static void |
setObject(Object bean,
Output output,
String prefix,
boolean overwrite)
Extract all properties from bean and place them in output.
|
static Object |
shouldConvertToNull(Object value,
Class<? extends Object> targetType) |
static Object |
tryToConvert(Object source,
Class targetType,
Locale loc) |
static Object |
tryToConvert(Object source,
Class targetType,
Locale loc,
boolean tryNumber) |
public static char PREFIX_SEPARATOR
public static void prepareForInjection(Class<? extends Object> klass, Map<String,Object> setters, Map<String,Object> fields)
public static Object tryToConvert(Object source, Class targetType, Locale loc, boolean tryNumber)
public static Object shouldConvertToNull(Object value, Class<? extends Object> targetType)
public static Method findMethodToInject(Class<? extends Object> target, String name, Class source)
public static Field findFieldToInject(Class<? extends Object> target, String name, Class<? extends Object> source)
public static boolean inject(Method m, Object target, Object value, Locale loc, boolean tryToConvert, boolean tryingToConvertBoolean) throws Exception
Exceptionpublic static void getObject(Object target, Input input, Locale loc, boolean tryField, String prefix, boolean tryToConvert, boolean convertBoolean, boolean allowRecursion) throws Exception
Exceptionpublic static void setObject(Object bean, Output output, String prefix, boolean overwrite)
bean - The beam from where to extract the properties.output - The output where to place the properties.prefix - The prefix to use when placing the properties in the output.overwrite - Overwrite ot not if value is already in the output.public static String getProperty(Object bean, String nameProperty) throws Exception
public static void beanToMap(Object bean, Map<String,String> map) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
Copyright © 2015. All Rights Reserved.