Source Code Cross Referenced for CtMember.java in  » Byte-Code » Javassist » javassist » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Byte Code » Javassist » javassist 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Javassist, a Java-bytecode translator toolkit.
003:         * Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.
004:         *
005:         * The contents of this file are subject to the Mozilla Public License Version
006:         * 1.1 (the "License"); you may not use this file except in compliance with
007:         * the License.  Alternatively, the contents of this file may be used under
008:         * the terms of the GNU Lesser General Public License Version 2.1 or later.
009:         *
010:         * Software distributed under the License is distributed on an "AS IS" basis,
011:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
012:         * for the specific language governing rights and limitations under the
013:         * License.
014:         */
015:
016:        package javassist;
017:
018:        /**
019:         * An instance of <code>CtMember</code> represents a field, a constructor,
020:         * or a method.
021:         */
022:        public abstract class CtMember {
023:            protected CtMember next; // for internal use
024:            protected CtClass declaringClass;
025:
026:            protected CtMember(CtClass clazz) {
027:                declaringClass = clazz;
028:            }
029:
030:            static CtMember append(CtMember list, CtMember previousTail,
031:                    CtMember tail) {
032:                tail.next = null;
033:                if (list == null)
034:                    return tail;
035:                else {
036:                    previousTail.next = tail;
037:                    return list;
038:                }
039:            }
040:
041:            static CtMember append(CtMember list, CtMember tail) {
042:                tail.next = null;
043:                if (list == null)
044:                    return tail;
045:                else {
046:                    CtMember lst = list;
047:                    while (lst.next != null)
048:                        lst = lst.next;
049:
050:                    lst.next = tail;
051:                    return list;
052:                }
053:            }
054:
055:            static int count(CtMember f) {
056:                int n = 0;
057:                while (f != null) {
058:                    ++n;
059:                    f = f.next;
060:                }
061:
062:                return n;
063:            }
064:
065:            static CtMember remove(CtMember list, CtMember m) {
066:                CtMember top = list;
067:                if (list == null)
068:                    return null;
069:                else if (list == m)
070:                    return list.next;
071:                else
072:                    while (list.next != null) {
073:                        if (list.next == m) {
074:                            list.next = list.next.next;
075:                            break;
076:                        }
077:
078:                        list = list.next;
079:                    }
080:
081:                return top;
082:            }
083:
084:            public String toString() {
085:                StringBuffer buffer = new StringBuffer(getClass().getName());
086:                buffer.append("@");
087:                buffer.append(Integer.toHexString(hashCode()));
088:                buffer.append("[");
089:                buffer.append(Modifier.toString(getModifiers()));
090:                extendToString(buffer);
091:                buffer.append("]");
092:                return buffer.toString();
093:            }
094:
095:            /**
096:             * Invoked by {@link #toString()} to add to the buffer and provide the
097:             * complete value.  Subclasses should invoke this method, adding a
098:             * space before each token.  The modifiers for the member are
099:             * provided first; subclasses should provide additional data such
100:             * as return type, field or method name, etc.
101:             */
102:            protected abstract void extendToString(StringBuffer buffer);
103:
104:            /**
105:             * Returns the class that declares this member.
106:             */
107:            public CtClass getDeclaringClass() {
108:                return declaringClass;
109:            }
110:
111:            /**
112:             * Returns true if this member is accessible from the given class.
113:             */
114:            public boolean visibleFrom(CtClass clazz) {
115:                int mod = getModifiers();
116:                if (Modifier.isPublic(mod))
117:                    return true;
118:                else if (Modifier.isPrivate(mod))
119:                    return clazz == declaringClass;
120:                else { // package or protected
121:                    String declName = declaringClass.getPackageName();
122:                    String fromName = clazz.getPackageName();
123:                    boolean visible;
124:                    if (declName == null)
125:                        visible = fromName == null;
126:                    else
127:                        visible = declName.equals(fromName);
128:
129:                    if (!visible && Modifier.isProtected(mod))
130:                        return clazz.subclassOf(declaringClass);
131:
132:                    return visible;
133:                }
134:            }
135:
136:            /**
137:             * Obtains the modifiers of the member.
138:             *
139:             * @return          modifiers encoded with
140:             *                  <code>javassist.Modifier</code>.
141:             * @see Modifier
142:             */
143:            public abstract int getModifiers();
144:
145:            /**
146:             * Sets the encoded modifiers of the member.
147:             *
148:             * @see Modifier
149:             */
150:            public abstract void setModifiers(int mod);
151:
152:            /**
153:             * Returns the annotations associated with this member.
154:             * For example, if an annotation <code>@Author</code> is associated
155:             * with this member, the returned array contains an <code>Author</code>
156:             * object.  The member values can be obtained by calling methods on
157:             * the <code>Author</code> object.
158:             *
159:             * @return an array of annotation-type objects.
160:             * @see CtClass#getAnnotations()
161:             */
162:            public abstract Object[] getAnnotations()
163:                    throws ClassNotFoundException;
164:
165:            /**
166:             * Returns the annotations associated with this member.
167:             * This method is equivalent to <code>getAnnotations()</code>
168:             * except that, if any annotations are not on the classpath,
169:             * they are not included in the returned array.
170:             *
171:             * @return an array of annotation-type objects.
172:             * @see #getAnnotations()
173:             * @see CtClass#getAvailableAnnotations()
174:             * @since 3.3
175:             */
176:            public abstract Object[] getAvailableAnnotations()
177:                    throws ClassNotFoundException;
178:
179:            /**
180:             * Obtains the name of the member.
181:             *
182:             * <p>As for constructor names, see <code>getName()</code>
183:             * in <code>CtConstructor</code>.
184:             *
185:             * @see CtConstructor#getName()
186:             */
187:            public abstract String getName();
188:
189:            /**
190:             * Returns the character string representing the signature of the member.
191:             * If two members have the same signature (parameter types etc.),
192:             * <code>getSignature()</code> returns the same string.
193:             */
194:            public abstract String getSignature();
195:
196:            /**
197:             * Obtains a user-defined attribute with the given name.
198:             * If that attribute is not found in the class file, this
199:             * method returns null.
200:             *
201:             * <p>Note that an attribute is a data block specified by
202:             * the class file format.
203:             * See {@link javassist.bytecode.AttributeInfo}.
204:             *
205:             * @param name              attribute name
206:             */
207:            public abstract byte[] getAttribute(String name);
208:
209:            /**
210:             * Adds a user-defined attribute. The attribute is saved in the class file.
211:             *
212:             * <p>Note that an attribute is a data block specified by
213:             * the class file format.
214:             * See {@link javassist.bytecode.AttributeInfo}.
215:             *
216:             * @param name      attribute name
217:             * @param data      attribute value
218:             */
219:            public abstract void setAttribute(String name, byte[] data);
220:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.