KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > enhancer > classfile > ClassMember


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.jdo.api.persistence.enhancer.classfile;
26
27 /**
28  * ClassMember is a common base class for ClassMethod and ClassField
29  */

30
31 abstract public class ClassMember implements VMConstants {
32
33   /* public accessors */
34
35   /**
36    * Is the member static?
37    */

38   final public boolean isStatic() {
39     return (access() & ACCStatic) != 0;
40   }
41
42   /**
43    * Is the member final?
44    */

45   final public boolean isFinal() {
46     return (access() & ACCFinal) != 0;
47   }
48
49   /**
50    * Turn on or off the final qualifier for the member.
51    */

52   public void setIsFinal(boolean newFinal) {
53     if (newFinal)
54       setAccess(access() | ACCFinal);
55     else
56       setAccess(access() & ~ACCFinal);
57   }
58
59   /**
60    * Is the member private?
61    */

62   final public boolean isPrivate() {
63     return (access() & ACCPrivate) != 0;
64   }
65
66   /**
67    * Is the member protected?
68    */

69   final public boolean isProtected() {
70     return (access() & ACCProtected) != 0;
71   }
72
73   /**
74    * Is the member public?
75    */

76   final public boolean isPublic() {
77     return (access() & ACCPublic) != 0;
78   }
79
80   /* These are expected to be implemented by subtypes */
81
82   /**
83    * Return the access flags for the method - see VMConstants
84    */

85   abstract public int access();
86
87   /**
88    * Set the access flags for the method - see VMConstants
89    */

90   abstract public void setAccess(int newAccess);
91
92   /**
93    * Return the name of the member
94    */

95   abstract public ConstUtf8 name();
96
97   /**
98    * Return the type signature of the method
99    */

100   abstract public ConstUtf8 signature();
101
102   /**
103    * Return the attributes associated with the member
104    */

105   abstract public AttributeVector attributes();
106
107 }
108
109
110
Popular Tags