|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
public interface PropertyDesc
プロパティを扱うためのインターフェースです。
メソッドの概要 | ||
---|---|---|
|
getAnnotation(Class<T> annotationClass)
プロパティから指定されたアノテーションを取得します。 |
|
ParameterizedClassDesc |
getParameterizedClassDesc()
このプロパティがパラメタ化された型の場合、その情報を返します。 |
|
String |
getPropertyName()
プロパティ名を返します。 |
|
Class<?> |
getPropertyType()
プロパティの型を返します。 |
|
Method |
getReadMethod()
getterメソッドを返します。 |
|
Object |
getValue(Object target)
プロパティの値を返します。 |
|
Method |
getWriteMethod()
setterメソッドを返します。 |
|
boolean |
hasReadMethod()
getterメソッドを持っているかどうか返します。 |
|
boolean |
hasWriteMethod()
setterメソッドを持っているかどうか返します。 |
|
boolean |
isAnnotationPresent(Class<? extends Annotation> annotationClass)
プロパティが指定されたアノテーションで修飾されているかを示します。 |
|
boolean |
isParameterized()
このプロパティがパラメタ化された型の場合に true を返します。 |
|
boolean |
isReadable()
プロパティの値が取得できるかどうかを返します。 |
|
boolean |
isWritable()
プロパティの値が設定できるかどうかを返します。 |
|
void |
setValue(Object target,
Object value)
プロパティに値を設定します。 |
メソッドの詳細 |
---|
String getPropertyName()
Class<?> getPropertyType()
Method getReadMethod()
boolean hasReadMethod()
Method getWriteMethod()
boolean hasWriteMethod()
boolean isReadable()
boolean isWritable()
Object getValue(Object target) throws IllegalPropertyException
target
-
IllegalPropertyException
- 値の取得に失敗した場合。void setValue(Object target, Object value) throws IllegalPropertyException
target
- value
-
IllegalPropertyException
- 値の設定に失敗した場合。boolean isParameterized()
true
を返します。
true
ParameterizedClassDesc getParameterizedClassDesc()
このプロパティがパラメタ化された型でない場合はnull
を返します。
<T extends Annotation> T getAnnotation(Class<T> annotationClass)
以下の順序でプロパティのメソッドの定義を検索し、最初に見つかったアノテーションを返します。
getReadMethod()
getWriteMethod()
また、クラスが Proxy
になどよって動的に生成されている場合などは、メソッドからアノテーションを取得することができません。
(アノテーションが Inherited
で修飾されている場合でも取得できません。)
そのため、読み込み/書き込みメソッドの定義を以下のように検索し、アノテーションを取得します。
Method.getDeclaringClass()
)
を検索対象クラスの起点とします。
T
- アノテーションannotationClass
- 取得するアノテーションの型
boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
annotationClass
- アノテーションの型
true
、そうでない場合は
false
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |