1 /*
2 * Copyright 2007-2008 Naoki NOSE.
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, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package jp.liq.container.reflect;
17
18 import java.lang.annotation.Annotation;
19
20 /**
21 * クラスのメンバです。
22 * このパッケージに含まれるリフレクション API のラッパの基底クラスです。
23 * @author nose
24 */
25 public abstract class Member {
26 /**
27 * メンバの名前を返します。
28 */
29 public abstract String name();
30
31 /**
32 * メンバに引数で指定されたアクセス修飾子が付与されているかどうかチェックします。
33 * @param modifier チェックするアクセス修飾子。
34 * java.lang.reflect.Modifier の持つ定数値を指定します。
35 * @return 指定されたアクセス修飾子が付与されている場合、true。
36 */
37 public final boolean hasModifier(int modifier) {
38 int mod = getModifiers();
39 return ((mod & modifier) != 0);
40 }
41
42 /**
43 * メンバに引数で指定されたアノテーションが存在するかどうかを返します。
44 * @param ann チェックするアノテーションのクラス
45 * @return メンバにアノテーションが存在する場合、true。
46 */
47 public abstract boolean isAnnotationPresent(Class<? extends Annotation> ann);
48 /**
49 * このメンバのアクセス修飾子を返します。
50 */
51 protected abstract int getModifiers();
52
53 }