Member.java revision f5597e626ecf7949d249dea08c1a2964d890ec11
1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 */
17
18package java.lang.reflect;
19
20/**
21 * Common interface providing access to reflective information on class members.
22 *
23 * @see Field
24 * @see Constructor
25 * @see Method
26 */
27public interface Member {
28
29    /**
30     * Designates all public members of a class or interface (including
31     * inherited members).
32     *
33     * @see java.lang.SecurityManager#checkMemberAccess
34     */
35    public static final int PUBLIC = 0;
36
37    /**
38     * Designates all declared members of a class or interface (without
39     * inherited members).
40     *
41     * @see java.lang.SecurityManager#checkMemberAccess
42     */
43    public static final int DECLARED = 1;
44
45    /**
46     * Returns the class that declares this member.
47     *
48     * @return the declaring class
49     */
50    @SuppressWarnings("unchecked")
51    Class getDeclaringClass();
52
53    /**
54     * Returns the modifiers for this member. The {@link Modifier} class should
55     * be used to decode the result.
56     *
57     * @return the modifiers for this member
58     *
59     * @see Modifier
60     */
61    int getModifiers();
62
63    /**
64     * Returns the name of this member.
65     *
66     * @return the name of this member
67     */
68    String getName();
69
70    /**
71     * Indicates whether or not this member is synthetic (artificially
72     * introduced by the compiler).
73     *
74     * @return {@code true} if this member is synthetic, {@code false} otherwise
75     */
76    boolean isSynthetic();
77}
78