public class ReflectUtil extends Object
| コンストラクタと説明 |
|---|
ReflectUtil() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static Object |
executeGetter(Method method,
Object object)
getter実行
|
static void |
executeSetter(Method method,
Object object,
Object value)
setter実行
|
static List |
getDeclaredMethodsList(Object object,
String regex)
objectに定義されているメソッドの中から、正規表現regexに該当するメソッドを取得する
|
static List |
getMethodsList(Object object,
String regex)
objectに定義されているメソッドの中から、正規表現regexに該当するメソッドを取得する
|
static boolean |
isCorrectGetter(Method method)
methodがpublic String getter()であることをチェックする
getterメソッドの対象を抽出した上で、このメソッドを呼ぶこと |
static boolean |
isCorrectSetter(Method method)
methodがpublic void setter(String)であることをチェックする
setterメソッドの対象を抽出した上で、このメソッドを呼ぶこと |
static boolean |
matchedMethod(String methodName,
String regex)
指定のメソッド名が正規表現パターンにマッチするかをチェックする。
|
public static List getMethodsList(Object object, String regex)
object - メソッド取得対象となるオブジェクトregex - メソッドを抽出するための正規表現文字列Listオブジェクトpublic static List getDeclaredMethodsList(Object object, String regex)
object - メソッド取得対象となるオブジェクトregex - メソッドを抽出するための正規表現文字列Listオブジェクトpublic static boolean matchedMethod(String methodName, String regex)
methodName - メソッド名文字列regex - メソッドを抽出するための正規表現文字列public static boolean isCorrectGetter(Method method)
method - チェック対象となるメソッドStringかString配列、Dtoクラスpublic static boolean isCorrectSetter(Method method)
method - チェック対象となるメソッドString、String配列、Dtoクラス、Dtoクラス配列public static Object executeGetter(Method method, Object object) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
method - 実行対象となるgetterのMethodobject - getterを保有するObjectObjectInvocationTargetExceptionIllegalAccessExceptionIllegalArgumentExceptionpublic static void executeSetter(Method method, Object object, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
method - 実行対象となるsetterのMethodobject - setterを保有するObjectvalue - 設定する値ObjectIllegalArgumentExceptionIllegalAccessExceptionInvocationTargetExceptionCopyright © 2025. All rights reserved.