Source Code Cross Referenced for FieldInfo.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » core » util » 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 » IDE Eclipse » jdt » org.eclipse.jdt.internal.core.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.internal.core.util;
011:
012:        import org.eclipse.jdt.core.util.ClassFormatException;
013:        import org.eclipse.jdt.core.util.IAttributeNamesConstants;
014:        import org.eclipse.jdt.core.util.IClassFileAttribute;
015:        import org.eclipse.jdt.core.util.IConstantPool;
016:        import org.eclipse.jdt.core.util.IConstantPoolConstant;
017:        import org.eclipse.jdt.core.util.IConstantPoolEntry;
018:        import org.eclipse.jdt.core.util.IConstantValueAttribute;
019:        import org.eclipse.jdt.core.util.IFieldInfo;
020:        import org.eclipse.jdt.core.util.IModifierConstants;
021:
022:        /**
023:         * Default implementation of IFieldInfo.
024:         */
025:        public class FieldInfo extends ClassFileStruct implements  IFieldInfo {
026:            private int accessFlags;
027:            private int attributeBytes;
028:            private IClassFileAttribute[] attributes;
029:            private int attributesCount;
030:            private IConstantValueAttribute constantValueAttribute;
031:            private char[] descriptor;
032:            private int descriptorIndex;
033:            private boolean isDeprecated;
034:            private boolean isSynthetic;
035:            private char[] name;
036:            private int nameIndex;
037:
038:            /**
039:             * @param classFileBytes byte[]
040:             * @param constantPool IConstantPool
041:             * @param offset int
042:             */
043:            public FieldInfo(byte classFileBytes[], IConstantPool constantPool,
044:                    int offset) throws ClassFormatException {
045:                final int flags = u2At(classFileBytes, 0, offset);
046:                this .accessFlags = flags;
047:                if ((flags & IModifierConstants.ACC_SYNTHETIC) != 0) {
048:                    this .isSynthetic = true;
049:                }
050:                this .nameIndex = u2At(classFileBytes, 2, offset);
051:                IConstantPoolEntry constantPoolEntry = constantPool
052:                        .decodeEntry(this .nameIndex);
053:                if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
054:                    throw new ClassFormatException(
055:                            ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
056:                }
057:                this .name = constantPoolEntry.getUtf8Value();
058:
059:                this .descriptorIndex = u2At(classFileBytes, 4, offset);
060:                constantPoolEntry = constantPool
061:                        .decodeEntry(this .descriptorIndex);
062:                if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
063:                    throw new ClassFormatException(
064:                            ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
065:                }
066:                this .descriptor = constantPoolEntry.getUtf8Value();
067:
068:                this .attributesCount = u2At(classFileBytes, 6, offset);
069:                this .attributes = ClassFileAttribute.NO_ATTRIBUTES;
070:                int readOffset = 8;
071:                if (this .attributesCount != 0) {
072:                    this .attributes = new IClassFileAttribute[this .attributesCount];
073:                }
074:                int attributesIndex = 0;
075:                for (int i = 0; i < this .attributesCount; i++) {
076:                    constantPoolEntry = constantPool.decodeEntry(u2At(
077:                            classFileBytes, readOffset, offset));
078:                    if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
079:                        throw new ClassFormatException(
080:                                ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
081:                    }
082:                    char[] attributeName = constantPoolEntry.getUtf8Value();
083:                    if (equals(attributeName,
084:                            IAttributeNamesConstants.DEPRECATED)) {
085:                        this .isDeprecated = true;
086:                        this .attributes[attributesIndex++] = new ClassFileAttribute(
087:                                classFileBytes, constantPool, offset
088:                                        + readOffset);
089:                    } else if (equals(attributeName,
090:                            IAttributeNamesConstants.SYNTHETIC)) {
091:                        this .isSynthetic = true;
092:                        this .attributes[attributesIndex++] = new ClassFileAttribute(
093:                                classFileBytes, constantPool, offset
094:                                        + readOffset);
095:                    } else if (equals(attributeName,
096:                            IAttributeNamesConstants.CONSTANT_VALUE)) {
097:                        this .constantValueAttribute = new ConstantValueAttribute(
098:                                classFileBytes, constantPool, offset
099:                                        + readOffset);
100:                        this .attributes[attributesIndex++] = this .constantValueAttribute;
101:                    } else if (equals(attributeName,
102:                            IAttributeNamesConstants.SIGNATURE)) {
103:                        this .attributes[attributesIndex++] = new SignatureAttribute(
104:                                classFileBytes, constantPool, offset
105:                                        + readOffset);
106:                    } else if (equals(
107:                            attributeName,
108:                            IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS)) {
109:                        this .attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(
110:                                classFileBytes, constantPool, offset
111:                                        + readOffset);
112:                    } else if (equals(
113:                            attributeName,
114:                            IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
115:                        this .attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(
116:                                classFileBytes, constantPool, offset
117:                                        + readOffset);
118:                    } else {
119:                        this .attributes[attributesIndex++] = new ClassFileAttribute(
120:                                classFileBytes, constantPool, offset
121:                                        + readOffset);
122:                    }
123:                    readOffset += (6 + u4At(classFileBytes, readOffset + 2,
124:                            offset));
125:                }
126:
127:                this .attributeBytes = readOffset;
128:            }
129:
130:            /**
131:             * @see IFieldInfo#getAccessFlags()
132:             */
133:            public int getAccessFlags() {
134:                return this .accessFlags;
135:            }
136:
137:            /**
138:             * @see IFieldInfo#getAttributeCount()
139:             */
140:            public int getAttributeCount() {
141:                return this .attributesCount;
142:            }
143:
144:            /**
145:             * @see IFieldInfo#getAttributes()
146:             */
147:            public IClassFileAttribute[] getAttributes() {
148:                return this .attributes;
149:            }
150:
151:            /**
152:             * @see IFieldInfo#getConstantValueAttribute()
153:             */
154:            public IConstantValueAttribute getConstantValueAttribute() {
155:                return this .constantValueAttribute;
156:            }
157:
158:            /**
159:             * @see IFieldInfo#getDescriptor()
160:             */
161:            public char[] getDescriptor() {
162:                return this .descriptor;
163:            }
164:
165:            /**
166:             * @see IFieldInfo#getDescriptorIndex()
167:             */
168:            public int getDescriptorIndex() {
169:                return this .descriptorIndex;
170:            }
171:
172:            /**
173:             * @see IFieldInfo#getName()
174:             */
175:            public char[] getName() {
176:                return this .name;
177:            }
178:
179:            /**
180:             * @see IFieldInfo#getNameIndex()
181:             */
182:            public int getNameIndex() {
183:                return this .nameIndex;
184:            }
185:
186:            /**
187:             * @see IFieldInfo#hasConstantValueAttribute()
188:             */
189:            public boolean hasConstantValueAttribute() {
190:                return this .constantValueAttribute != null;
191:            }
192:
193:            /**
194:             * @see IFieldInfo#isDeprecated()
195:             */
196:            public boolean isDeprecated() {
197:                return this .isDeprecated;
198:            }
199:
200:            /**
201:             * @see IFieldInfo#isSynthetic()
202:             */
203:            public boolean isSynthetic() {
204:                return this .isSynthetic;
205:            }
206:
207:            int sizeInBytes() {
208:                return this.attributeBytes;
209:            }
210:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.