public class PojoUtils extends Object
| Constructor and Description |
|---|
PojoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
generalize(Object pojo) |
static Object[] |
generalize(Object[] objs) |
static boolean |
isPojo(Class<?> cls) |
static <T> T |
mapToPojo(Map<String,Object> map,
Class<T> cls)
convert map to a specific class instance
|
static Object[] |
realize(Object[] objs,
Class<?>[] types) |
static Object[] |
realize(Object[] objs,
Class<?>[] types,
Type[] gtypes) |
static Object |
realize(Object pojo,
Class<?> type) |
static Object |
realize(Object pojo,
Class<?> type,
Type genericType) |
static <T> void |
updatePropertyIfAbsent(Supplier<T> getterMethod,
Consumer<T> setterMethod,
T newValue)
Update the property if absent
|
public static boolean isPojo(Class<?> cls)
public static <T> void updatePropertyIfAbsent(Supplier<T> getterMethod, Consumer<T> setterMethod, T newValue)
T - the value typegetterMethod - the getter methodsetterMethod - the setter methodnewValue - the new valuepublic static <T> T mapToPojo(Map<String,Object> map, Class<T> cls) throws ReflectiveOperationException
T - the type of clsmap - map wait for convertcls - the specified classclsReflectiveOperationException - if the instance creation is failedCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.