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


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2005 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.jdi.internal;
011:
012:        import java.io.DataInputStream;
013:        import java.io.DataOutputStream;
014:        import java.io.IOException;
015:
016:        import org.eclipse.jdi.internal.jdwp.JdwpFieldID;
017:
018:        import com.sun.jdi.ClassNotLoadedException;
019:        import com.sun.jdi.Field;
020:        import com.sun.jdi.Type;
021:
022:        /**
023:         * this class implements the corresponding interfaces
024:         * declared by the JDI specification. See the com.sun.jdi package
025:         * for more information.
026:         *
027:         */
028:        public class FieldImpl extends TypeComponentImpl implements  Field {
029:            /** ID that corresponds to this reference. */
030:            private JdwpFieldID fFieldID;
031:            private Type fType;
032:            private String fTypeName;
033:
034:            /**
035:             * Creates new FieldImpl.
036:             */
037:            public FieldImpl(VirtualMachineImpl vmImpl,
038:                    ReferenceTypeImpl declaringType, JdwpFieldID ID,
039:                    String name, String signature, String genericSignature,
040:                    int modifierBits) {
041:                super (
042:                        "Field", vmImpl, declaringType, name, signature, genericSignature, modifierBits); //$NON-NLS-1$
043:                fFieldID = ID;
044:            }
045:
046:            /**
047:             * Flushes all stored Jdwp results.
048:             */
049:            public void flushStoredJdwpResults() {
050:                // Note that no results are cached.
051:            }
052:
053:            /** 
054:             * @return Returns fieldID of field.
055:             */
056:            public JdwpFieldID getFieldID() {
057:                return fFieldID;
058:            }
059:
060:            /**
061:             * @return Returns true if two mirrors refer to the same entity in the target VM.
062:             * @see java.lang.Object#equals(Object)
063:             */
064:            public boolean equals(Object object) {
065:                return object != null
066:                        && object.getClass().equals(this .getClass())
067:                        && fFieldID.equals(((FieldImpl) object).fFieldID)
068:                        && referenceTypeImpl().equals(
069:                                ((FieldImpl) object).referenceTypeImpl());
070:            }
071:
072:            /**
073:             * @return Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
074:             */
075:            public int compareTo(Object object) {
076:                if (object == null
077:                        || !object.getClass().equals(this .getClass()))
078:                    throw new ClassCastException(
079:                            JDIMessages.FieldImpl_Can__t_compare_field_to_given_object_1);
080:
081:                // See if declaring types are the same, if not return comparison between declaring types.
082:                Field type2 = (Field) object;
083:                if (!declaringType().equals(type2.declaringType()))
084:                    return declaringType().compareTo(type2.declaringType());
085:
086:                // Return comparison of position within declaring type.
087:                int index1 = declaringType().fields().indexOf(this );
088:                int index2 = type2.declaringType().fields().indexOf(type2);
089:                if (index1 < index2)
090:                    return -1;
091:                else if (index1 > index2)
092:                    return 1;
093:                else
094:                    return 0;
095:            }
096:
097:            /** 
098:             * @return Returns the hash code value.
099:             */
100:            public int hashCode() {
101:                return fFieldID.hashCode();
102:            }
103:
104:            /**
105:             * @return Returns a text representation of the declared type.
106:             */
107:            public String typeName() {
108:                if (fTypeName == null) {
109:                    fTypeName = TypeImpl.signatureToName(signature());
110:                }
111:                return fTypeName;
112:            }
113:
114:            /** 
115:             * @return Returns the type of the this Field.
116:             */
117:            public Type type() throws ClassNotLoadedException {
118:                if (fType == null) {
119:                    fType = TypeImpl.create(virtualMachineImpl(), signature(),
120:                            declaringType().classLoader());
121:                }
122:                return fType;
123:            }
124:
125:            /** 
126:             * @return Returns true if object is transient.
127:             */
128:            public boolean isTransient() {
129:                return (fModifierBits & MODIFIER_ACC_TRANSIENT) != 0;
130:            }
131:
132:            /** 
133:             * @return Returns true if object is volitile.
134:             */
135:            public boolean isVolatile() {
136:                return (fModifierBits & MODIFIER_ACC_VOLITILE) != 0;
137:            }
138:
139:            /**
140:             * Writes JDWP representation.
141:             */
142:            public void write(MirrorImpl target, DataOutputStream out)
143:                    throws IOException {
144:                fFieldID.write(out);
145:                if (target.fVerboseWriter != null)
146:                    target.fVerboseWriter.println("field", fFieldID.value()); //$NON-NLS-1$
147:            }
148:
149:            /**
150:             * Writes JDWP representation, including ReferenceType.
151:             */
152:            public void writeWithReferenceType(MirrorImpl target,
153:                    DataOutputStream out) throws IOException {
154:                // See EventRequest case FieldOnly
155:                referenceTypeImpl().write(target, out);
156:                write(target, out);
157:            }
158:
159:            /**
160:             * @return Reads JDWP representation and returns new instance.
161:             */
162:            public static FieldImpl readWithReferenceTypeWithTag(
163:                    MirrorImpl target, DataInputStream in) throws IOException {
164:                VirtualMachineImpl vmImpl = target.virtualMachineImpl();
165:                // See Events FIELD_ACCESS and FIELD_MODIFICATION (refTypeTag + typeID + fieldID).
166:                ReferenceTypeImpl referenceType = ReferenceTypeImpl
167:                        .readWithTypeTag(target, in);
168:                if (referenceType == null)
169:                    return null;
170:
171:                JdwpFieldID ID = new JdwpFieldID(vmImpl);
172:                ID.read(in);
173:                if (target.fVerboseWriter != null)
174:                    target.fVerboseWriter.println("field", ID.value()); //$NON-NLS-1$
175:
176:                if (ID.isNull())
177:                    return null;
178:                FieldImpl field = referenceType.findField(ID);
179:                if (field == null)
180:                    throw new InternalError(
181:                            JDIMessages.FieldImpl_Got_FieldID_of_ReferenceType_that_is_not_a_member_of_the_ReferenceType_2);
182:                return field;
183:            }
184:
185:            /**
186:             * @return Reads JDWP representation and returns new instance.
187:             */
188:            public static FieldImpl readWithNameSignatureModifiers(
189:                    ReferenceTypeImpl target, ReferenceTypeImpl referenceType,
190:                    boolean withGenericSignature, DataInputStream in)
191:                    throws IOException {
192:                VirtualMachineImpl vmImpl = target.virtualMachineImpl();
193:                JdwpFieldID ID = new JdwpFieldID(vmImpl);
194:                ID.read(in);
195:                if (target.fVerboseWriter != null)
196:                    target.fVerboseWriter.println("field", ID.value()); //$NON-NLS-1$
197:
198:                if (ID.isNull())
199:                    return null;
200:                String name = target.readString("name", in); //$NON-NLS-1$
201:                String signature = target.readString("signature", in); //$NON-NLS-1$
202:                String genericSignature = null;
203:                if (withGenericSignature) {
204:                    genericSignature = target.readString(
205:                            "generic signature", in); //$NON-NLS-1$
206:                    if ("".equals(genericSignature)) { //$NON-NLS-1$
207:                        genericSignature = null;
208:                    }
209:                }
210:                int modifierBits = target.readInt(
211:                        "modifiers", AccessibleImpl.getModifierStrings(), in); //$NON-NLS-1$
212:
213:                FieldImpl mirror = new FieldImpl(vmImpl, referenceType, ID,
214:                        name, signature, genericSignature, modifierBits);
215:                return mirror;
216:            }
217:
218:            public boolean isEnumConstant() {
219:                return (fModifierBits & MODIFIER_ACC_ENUM) != 0;
220:            }
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.