Reflection 工具
在 com.iisigroup.ude.util.lang8.reflect.* 下,提供了部分java reflection功能的再包裝。原則上不建議一般專案使用,但若用於開發各專案的底層元件,或許有所助益。請參考JAVA DOC 使用。
主要提供Field 讀寫包裝,改checkedException為uncheckException,或提供DEFAULT-VALUE、annotation處理、物件比對複製等特性。
- UdeAnnotationUtils
- UdeClassUtils
- forName(String name) :: Class
- getClass(E obj) :: Class
- forName(String name) :: Class
- UdeFieldUtils
- read(Object, Field)
- read(Object, Field, Function
) - read(Object, String)
- read(Object, String, Function
) - readOrElse(Object, Field, T)
- readOrElse(Object, String, T)
- readStatic(Class<?>, String)
- readStatic(Class<?>, String, Function
) - readStatic(Field)
- readStatic(Field, Function
) - readStaticOrElse(Class<?>, String, T)
- readStaticOrElse(Field, T)
- write(Object, Field, Object)
- write(Object, Field, Object, BiFunction
) - write(Object, String, Object)
- write(Object, String, Object, BiFunction
) - writeStatic(Class<?>, String, Object)
- writeStatic(Class<?>, String, Object, BiFunction
) - writeStatic(Field, Object)
- writeStatic(Field, Object, BiFunction
) - writeURTException(Throwable, String)
- UdeMethodUtils
- getMethod(Class<?>, String, Class<?>...)
- invokeForce(Object, String, Class<?>[], Object...)
- invokeForce(Object, String, Object...)
- UdeReflectUtils
- copyFields(Object, Object, String... ignoreFields)
- copyProperties(Object, Object, String... ignoreProperties)
- diff(T, T) :: T
- getInstanceFields(Class
) :: List // 找出非 STATIC/FINAL的 instance variable(含父類別). - isFinal(Class<?>) :: boolean
- isFinal(Member) :: boolean
- isPublic(Class<?>) :: boolean
- isPublic(Member) :: boolean
- isStatic(Class<?>) :: boolean
- isStatic(Member) :: boolean