类 PojoUtils
- java.lang.Object
-
- org.apache.dubbo.common.utils.PojoUtils
-
public class PojoUtils extends Object
PojoUtils. Travel object deeply, and convert complex type to simple type. Simple type below will be remained:- Primitive Type, also include String, Number(Integer, Long), Date
- Array of Primitive Type
- Collection, eg: List, Map, Set etc.
-
-
构造器概要
构造器 构造器 说明 PojoUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Objectgeneralize(Object pojo)static Object[]generalize(Object[] objs)static booleanisPojo(Class<?> cls)static <T> TmapToPojo(Map<String,Object> map, Class<T> cls)convert map to a specific class instancestatic Object[]realize(Object[] objs, Class<?>[] types)static Object[]realize(Object[] objs, Class<?>[] types, Type[] gtypes)static Objectrealize(Object pojo, Class<?> type)static Objectrealize(Object pojo, Class<?> type, Type genericType)static <T> voidupdatePropertyIfAbsent(Supplier<T> getterMethod, Consumer<T> setterMethod, T newValue)Update the property if absent
-
-
-
方法详细资料
-
isPojo
public static boolean isPojo(Class<?> cls)
-
updatePropertyIfAbsent
public static <T> void updatePropertyIfAbsent(Supplier<T> getterMethod, Consumer<T> setterMethod, T newValue)
Update the property if absent- 类型参数:
T- the value type- 参数:
getterMethod- the getter methodsetterMethod- the setter methodnewValue- the new value- 从以下版本开始:
- 2.7.8
-
mapToPojo
public static <T> T mapToPojo(Map<String,Object> map, Class<T> cls) throws ReflectiveOperationException
convert map to a specific class instance- 类型参数:
T- the type ofcls- 参数:
map- map wait for convertcls- the specified class- 返回:
- class instance declare in param
cls - 抛出:
ReflectiveOperationException- if the instance creation is failed- 从以下版本开始:
- 2.7.10
-
-