|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
public interface BeanDesc
JavaBeansのメタデータを扱うためのインターフェースです。
BeanDescのインスタンスはBeanDescFactoryから取得します。
BeanDesc beanDesc = BeanDescFactory.getBeanDesc(Foo.class);
取得したBeanDescから,対象となるJavaBeansのプロパティやフィールド、コンストラクタ、メソッドのメタデータを取得できます。
for (PropertyDesc propertyDesc : beanDesc.getPropertyDescs()) {
propertyDesc.getValue(foo); // Foo のプロパティの値を取得
}
for (FieldDesc fieldDesc : beanDesc.getFieldDescs()) {
fieldDesc.getFileldValue(foo); // Foo のフィールドの値を取得
}
for (ConstructorDesc constructorDesc : beanDesc.getConstructorDescs()) {
constructorDesc.newInstance(...); // Foo のインスタンスを生成
}
for (String methodName : beanDesc.getMethodNames()) {
for (MethodDesc methodDesc : beanDesc.getMethodDescs(methodName)) {
methodDesc.invoke(foo, ...); // Foo のメソッドを起動
}
}
BeanDescFactory| メソッドの詳細 |
|---|
<T> Class<T> getBeanClass()
T - Beanのクラス
Map<TypeVariable<?>,Type> getTypeVariables()
boolean hasPropertyDesc(String propertyName)
PropertyDescを持っているかどうかを返します。
propertyName - プロパティ名。nullや空文字列であってはいけません
PropertyDescを持っているかどうかPropertyDesc getPropertyDesc(String propertyName)
PropertyDescを返します。
propertyName - プロパティ名。nullや空文字列であってはいけません
PropertyDescPropertyDesc getPropertyDesc(int index)
PropertyDescを返します。
index - PropertyDescのインデックス
PropertyDescint getPropertyDescSize()
PropertyDescの数を返します。
PropertyDescの数Iterable<PropertyDesc> getPropertyDescs()
PropertyDescのIterableを返します。
PropertyDescのIterableboolean hasFieldDesc(String fieldName)
FieldDescを持っているかどうかを返します。
fieldName - フィールド名。nullや空文字列であってはいけません
FieldDescを持っているかどうかFieldDesc getFieldDesc(String fieldName)
FieldDescを返します。
fieldName - フィールド名。nullや空文字列であってはいけません
FieldDescFieldDesc getFieldDesc(int index)
FieldDescを返します。
index - FieldDescのインデックス
FieldDescint getFieldDescSize()
FieldDescの数を返します。
FieldDescの数Iterable<FieldDesc> getFieldDescs()
FieldDescのIterableを返します。
FieldDescのIterable<T> T newInstance(Object... args)
T - Beanクラスの型args - コンストラクタに渡す引数の並び
ConstructorDesc getConstructorDesc(Class<?>... paramTypes)
ConstructorDescを返します。
paramTypes - コンストラクタに渡す引数型の並び
ConstructorDescConstructorDesc getSuitableConstructorDesc(Object... args)
ConstructorDescを返します。
args - コンストラクタに渡す引数の並び
ConstructorConstructorDesc getConstructorDesc(int index)
ConstructorDescを返します。
index - ConstructorDescのインデックス
ConstructorDescint getConstructorDescSize()
ConstructorDescの数を返します。
ConstructorDescの数Iterable<ConstructorDesc> getConstructorDescs()
ConstructorDescのIterableを返します。
ConstructorDescのIterable
MethodDesc getMethodDesc(String methodName,
Class<?>... paramTypes)
MethodDescを返します。
methodName - メソッド名。nullや空文字列であってはいけませんparamTypes - メソッドの引数型の並び
MethodDesc メソッド
MethodDesc getMethodDescNoException(String methodName,
Class<?>... paramTypes)
MethodDescを返します。見つからない場合は、nullを返します。
methodName - メソッド名。nullや空文字列であってはいけませんparamTypes - メソッドの引数型の並び
MethodDesc
MethodDesc getSuitableMethodDesc(String methodName,
Object... args)
MethodDescを返します。
methodName - メソッド名。nullや空文字列であってはいけませんargs - メソッドの引数の並び
MethodDesc メソッドboolean hasMethodDesc(String methodName)
MethodDescがあるかどうか返します。
methodName - メソッド名。nullや空文字列であってはいけません
MethodDescがあるかどうかMethodDesc[] getMethodDescs(String methodName)
MethodDescの配列を返します。
methodName - メソッド名。nullや空文字列であってはいけません
MethodDescの配列String[] getMethodNames()
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||