org.seasar.util.beans
インタフェース BeanDesc

既知の実装クラスの一覧:
BeanDescImpl

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 のメソッドを起動
     }
 }
 

作成者:
higa
関連項目:
BeanDescFactory

メソッドの概要
<T> Class<T>
getBeanClass()
          Beanのクラスを返します。
 ConstructorDesc getConstructorDesc(Class<?>... paramTypes)
          引数の型に応じたConstructorDescを返します。
 ConstructorDesc getConstructorDesc(int index)
          ConstructorDescを返します。
 Iterable<ConstructorDesc> getConstructorDescs()
          ConstructorDescIterableを返します。
 int getConstructorDescSize()
          ConstructorDescの数を返します。
 FieldDesc getFieldDesc(int index)
          FieldDescを返します。
 FieldDesc getFieldDesc(String fieldName)
          FieldDescを返します。
 Iterable<FieldDesc> getFieldDescs()
          FieldDescIterableを返します。
 int getFieldDescSize()
          FieldDescの数を返します。
 MethodDesc getMethodDesc(String methodName, Class<?>... paramTypes)
          引数の型に応じたMethodDescを返します。
 MethodDesc getMethodDescNoException(String methodName, Class<?>... paramTypes)
          引数の型に応じたMethodDescを返します。
 MethodDesc[] getMethodDescs(String methodName)
          MethodDescの配列を返します。
 String[] getMethodNames()
          メソッド名の配列を返します。
 PropertyDesc getPropertyDesc(int index)
          PropertyDescを返します。
 PropertyDesc getPropertyDesc(String propertyName)
          PropertyDescを返します。
 Iterable<PropertyDesc> getPropertyDescs()
          PropertyDescIterableを返します。
 int getPropertyDescSize()
          PropertyDescの数を返します。
 ConstructorDesc getSuitableConstructorDesc(Object... args)
          引数に適合するConstructorDescを返します。
 MethodDesc getSuitableMethodDesc(String methodName, Object... args)
          引数に適合するMethodDescを返します。
 Map<TypeVariable<?>,Type> getTypeVariables()
          型変数から型引数へのマップを返します。
 boolean hasFieldDesc(String fieldName)
          FieldDescを持っているかどうかを返します。
 boolean hasMethodDesc(String methodName)
          MethodDescがあるかどうか返します。
 boolean hasPropertyDesc(String propertyName)
          PropertyDescを持っているかどうかを返します。
<T> T
newInstance(Object... args)
          新しいインスタンスを作成します。
 

メソッドの詳細

getBeanClass

<T> Class<T> getBeanClass()
Beanのクラスを返します。

型パラメータ:
T - Beanのクラス
戻り値:
Beanのクラス

getTypeVariables

Map<TypeVariable<?>,Type> getTypeVariables()
型変数から型引数へのマップを返します。

戻り値:
型変数から型引数へのマップ

hasPropertyDesc

boolean hasPropertyDesc(String propertyName)
PropertyDescを持っているかどうかを返します。

パラメータ:
propertyName - プロパティ名。nullや空文字列であってはいけません
戻り値:
PropertyDescを持っているかどうか

getPropertyDesc

PropertyDesc getPropertyDesc(String propertyName)
PropertyDescを返します。

パラメータ:
propertyName - プロパティ名。nullや空文字列であってはいけません
戻り値:
PropertyDesc

getPropertyDesc

PropertyDesc getPropertyDesc(int index)
PropertyDescを返します。

パラメータ:
index - PropertyDescのインデックス
戻り値:
PropertyDesc

getPropertyDescSize

int getPropertyDescSize()
PropertyDescの数を返します。

戻り値:
PropertyDescの数

getPropertyDescs

Iterable<PropertyDesc> getPropertyDescs()
PropertyDescIterableを返します。

戻り値:
PropertyDescIterable

hasFieldDesc

boolean hasFieldDesc(String fieldName)
FieldDescを持っているかどうかを返します。

パラメータ:
fieldName - フィールド名。nullや空文字列であってはいけません
戻り値:
FieldDescを持っているかどうか

getFieldDesc

FieldDesc getFieldDesc(String fieldName)
FieldDescを返します。

パラメータ:
fieldName - フィールド名。nullや空文字列であってはいけません
戻り値:
FieldDesc

getFieldDesc

FieldDesc getFieldDesc(int index)
FieldDescを返します。

パラメータ:
index - FieldDescのインデックス
戻り値:
FieldDesc

getFieldDescSize

int getFieldDescSize()
FieldDescの数を返します。

戻り値:
FieldDescの数

getFieldDescs

Iterable<FieldDesc> getFieldDescs()
FieldDescIterableを返します。

戻り値:
FieldDescIterable

newInstance

<T> T newInstance(Object... args)
新しいインスタンスを作成します。

型パラメータ:
T - Beanクラスの型
パラメータ:
args - コンストラクタに渡す引数の並び
戻り値:
新しいインスタンス

getConstructorDesc

ConstructorDesc getConstructorDesc(Class<?>... paramTypes)
引数の型に応じたConstructorDescを返します。

パラメータ:
paramTypes - コンストラクタに渡す引数型の並び
戻り値:
引数の型に応じたConstructorDesc

getSuitableConstructorDesc

ConstructorDesc getSuitableConstructorDesc(Object... args)
引数に適合するConstructorDescを返します。

パラメータ:
args - コンストラクタに渡す引数の並び
戻り値:
引数に適合するConstructor

getConstructorDesc

ConstructorDesc getConstructorDesc(int index)
ConstructorDescを返します。

パラメータ:
index - ConstructorDescのインデックス
戻り値:
ConstructorDesc

getConstructorDescSize

int getConstructorDescSize()
ConstructorDescの数を返します。

戻り値:
ConstructorDescの数

getConstructorDescs

Iterable<ConstructorDesc> getConstructorDescs()
ConstructorDescIterableを返します。

戻り値:
ConstructorDescIterable

getMethodDesc

MethodDesc getMethodDesc(String methodName,
                         Class<?>... paramTypes)
引数の型に応じたMethodDescを返します。

パラメータ:
methodName - メソッド名。nullや空文字列であってはいけません
paramTypes - メソッドの引数型の並び
戻り値:
引数の型に応じたMethodDesc メソッド

getMethodDescNoException

MethodDesc getMethodDescNoException(String methodName,
                                    Class<?>... paramTypes)
引数の型に応じたMethodDescを返します。見つからない場合は、nullを返します。

パラメータ:
methodName - メソッド名。nullや空文字列であってはいけません
paramTypes - メソッドの引数型の並び
戻り値:
引数の型に応じたMethodDesc

getSuitableMethodDesc

MethodDesc getSuitableMethodDesc(String methodName,
                                 Object... args)
引数に適合するMethodDescを返します。

パラメータ:
methodName - メソッド名。nullや空文字列であってはいけません
args - メソッドの引数の並び
戻り値:
引数に適合するMethodDesc メソッド

hasMethodDesc

boolean hasMethodDesc(String methodName)
MethodDescがあるかどうか返します。

パラメータ:
methodName - メソッド名。nullや空文字列であってはいけません
戻り値:
MethodDescがあるかどうか

getMethodDescs

MethodDesc[] getMethodDescs(String methodName)
MethodDescの配列を返します。

パラメータ:
methodName - メソッド名。nullや空文字列であってはいけません
戻り値:
MethodDescの配列

getMethodNames

String[] getMethodNames()
メソッド名の配列を返します。

戻り値:
メソッド名の配列


Copyright © 2010-2012 The Seasar Foundation. All Rights Reserved.