Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Attribute |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2004-2010 the Seasar Foundation and the Others. | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | |
13 | * either express or implied. See the License for the specific language | |
14 | * governing permissions and limitations under the License. | |
15 | */ | |
16 | ||
17 | package org.seasar.cubby.spi.beans; | |
18 | ||
19 | import java.lang.annotation.Annotation; | |
20 | ||
21 | /** | |
22 | * オブジェクトの属性を扱うためのインターフェイスです。 | |
23 | * | |
24 | * @author baba | |
25 | */ | |
26 | public interface Attribute { | |
27 | ||
28 | /** | |
29 | * 属性名を返します。 | |
30 | * | |
31 | * @return 属性名 | |
32 | */ | |
33 | String getName(); | |
34 | ||
35 | /** | |
36 | * 属性の型を返します。 | |
37 | * | |
38 | * @return 属性の型 | |
39 | */ | |
40 | Class<?> getType(); | |
41 | ||
42 | /** | |
43 | * 属性の値が取得可能かどうかを返します。 | |
44 | * | |
45 | * @return 属性の値が取得可能かどうか | |
46 | */ | |
47 | boolean isReadable(); | |
48 | ||
49 | /** | |
50 | * 属性の値が設定可能かどうかを返します。 | |
51 | * | |
52 | * @return 属性の値が設定可能かどうか | |
53 | */ | |
54 | boolean isWritable(); | |
55 | ||
56 | /** | |
57 | * 属性の値を返します。 | |
58 | * | |
59 | * @param target | |
60 | * 値を取得するオブジェクト | |
61 | * @return 属性の値 | |
62 | * @throws IllegalAttributeException | |
63 | * 値の取得に失敗した場合。 | |
64 | */ | |
65 | Object getValue(Object target); | |
66 | ||
67 | /** | |
68 | * 属性に値を設定します。 | |
69 | * | |
70 | * @param target | |
71 | * 値を設定するオブジェクト | |
72 | * @param value | |
73 | * 設定する値 | |
74 | * @throws IllegalAttributeException | |
75 | * 値の設定に失敗した場合 | |
76 | */ | |
77 | void setValue(Object target, Object value); | |
78 | ||
79 | /** | |
80 | * この属性がパラメタ化された型の場合、その情報を返します。 | |
81 | * <p> | |
82 | * この属性がパラメタ化された型でない場合は<code>null</code>を返します。 | |
83 | * </p> | |
84 | * | |
85 | * @return この属性がパラメタ化された型の場合、その情報 | |
86 | */ | |
87 | ParameterizedClassDesc getParameterizedClassDesc(); | |
88 | ||
89 | /** | |
90 | * 属性から指定されたアノテーションを取得します。 | |
91 | * | |
92 | * @param <T> | |
93 | * アノテーション | |
94 | * @param annotationClass | |
95 | * 取得するアノテーションの型 | |
96 | * @return アノテーション | |
97 | */ | |
98 | <T extends Annotation> T getAnnotation(Class<T> annotationClass); | |
99 | ||
100 | /** | |
101 | * 属性が指定されたアノテーションで修飾されているかを示します。 | |
102 | * | |
103 | * @param annotationClass | |
104 | * アノテーションの型 | |
105 | * @return 属性が指定されたアノテーションで修飾されている場合は <code>true</code>、そうでない場合は | |
106 | * <code>false</code> | |
107 | */ | |
108 | boolean isAnnotationPresent(Class<? extends Annotation> annotationClass); | |
109 | ||
110 | } |