Source Code Cross Referenced for Objects.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » kernel » vm » 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 » Apache Harmony Java SE » org package » org.apache.harmony.kernel.vm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.harmony.kernel.vm;
019:
020:        import java.lang.reflect.Field;
021:        import java.security.AccessController;
022:        import java.security.PrivilegedAction;
023:
024:        /**
025:         * <p>
026:         * This class must be implemented by the VM to support Object manipulation.
027:         * </p>
028:         */
029:        public class Objects {
030:            private static final Objects INSTANCE = new Objects();
031:
032:            /**
033:             * <p>
034:             * Retrieves an instance of the Objects service.
035:             * </p>
036:             * 
037:             * @return An instance of Objects.
038:             */
039:            public static Objects getInstance() {
040:                // TODO add class loader check
041:                return AccessController
042:                        .doPrivileged(new PrivilegedAction<Objects>() {
043:                            public Objects run() {
044:                                return INSTANCE;
045:                            }
046:                        });
047:            }
048:
049:            private Objects() {
050:                super ();
051:            }
052:
053:            /**
054:             * <p>
055:             * Retrieves the offset value of the {@link Field} for use by other methods
056:             * in this class.
057:             * </p>
058:             * 
059:             * @param field The {@link Field} to retrieve the offset for.
060:             * @return The offset value.
061:             */
062:            public long getFieldOffset(Field field) {
063:                return 0L;
064:            }
065:
066:            /**
067:             * <p>
068:             * Retrieves the base offset for the array Class given. The Class passed
069:             * MUST me an array type, such that the method {@link Class#isArray()}
070:             * returns <code>true</code>. For example, <code>int[].class</code>.
071:             * </p>
072:             * 
073:             * @param clazz The array Class object.
074:             * @return The base offset value.
075:             * @throws NullPointerException if <code>clazz</code> is <code>null</code>.
076:             * @throws IllegalArgumentException if <code>clazz</code> is not an array type.
077:             */
078:            public int getArrayBaseOffset(Class<?> clazz) {
079:                if (!clazz.isArray()) {
080:                    throw new IllegalArgumentException();
081:                }
082:                return 0;
083:            }
084:
085:            /**
086:             * <p>
087:             * Retrieves the array index scale for the array Class given. The index
088:             * scale is the value used to determine the offset of a particular element
089:             * in the array given the array's base offset and an index. The following
090:             * code snippet illustrates the usage.
091:             * </p>
092:             * 
093:             * <pre>
094:             * int base = Objects.getArrayBaseOffset(int[].class);
095:             * 
096:             * int scale = Objects.getArrayIndexScale(int[].class);
097:             * 
098:             * int elementIdx = 1;
099:             * 
100:             * int[] array = { 0, 1, 2 };
101:             * 
102:             * long offsetForIdx = base + (elementIdx * scale);
103:             * </pre>
104:             * 
105:             * <p>
106:             * The Class passed MUST me an array type, such that the method
107:             * {@link Class#isArray()} returns <code>true</code>. For example,
108:             * <code>int[].class</code>.
109:             * </p>
110:             * 
111:             * @param clazz The array Class object.
112:             * @return The index scale value.
113:             * @throws NullPointerException if <code>clazz</code> is <code>null</code>.
114:             * @throws IllegalArgumentException if <code>clazz</code> is not an array type.
115:             */
116:            public int getArrayIndexScale(Class<?> clazz) {
117:                if (!clazz.isArray()) {
118:                    throw new IllegalArgumentException();
119:                }
120:                return 0;
121:            }
122:
123:            /**
124:             * <p>
125:             * Compares and swaps the value of an int-typed field on an Object instance.
126:             * </p>
127:             * 
128:             * @param object The instance containing the field.
129:             * @param fieldOffset The offset value of the field.
130:             * @param expected The expected value of the field.
131:             * @param update The new value to write to the field.
132:             * @return <code>true</code> if the field was updated, <code>false</code>
133:             *         otherwise.
134:             */
135:            public boolean compareAndSwapInt(Object object, long fieldOffset,
136:                    int expected, int update) {
137:                return false;
138:            }
139:
140:            /**
141:             * <p>
142:             * Compares and swaps the value of a long-typed field on an Object instance.
143:             * </p>
144:             * 
145:             * @param object The instance containing the field.
146:             * @param fieldOffset The offset value of the field.
147:             * @param expected The expected value of the field.
148:             * @param update The new value to write to the field.
149:             * @return <code>true</code> if the field was updated, <code>false</code>
150:             *         otherwise.
151:             */
152:            public boolean compareAndSwapLong(Object object, long fieldOffset,
153:                    long expected, long update) {
154:                return false;
155:            }
156:
157:            /**
158:             * <p>
159:             * Compares and swaps the value of an Object-typed field on an Object
160:             * instance.
161:             * </p>
162:             * 
163:             * @param object The instance containing the field.
164:             * @param fieldOffset The offset value of the field.
165:             * @param expected The expected value of the field.
166:             * @param update The new value to write to the field.
167:             * @return <code>true</code> if the field was updated, <code>false</code>
168:             *         otherwise.
169:             */
170:            public boolean compareAndSwapObject(Object object,
171:                    long fieldOffset, Object expected, Object update) {
172:                return false;
173:            }
174:
175:            /**
176:             * <p>
177:             * Writes an int value to an Object's field as though it were declared
178:             * <code>volatile</code>.
179:             * </p>
180:             * 
181:             * @param object The instance containing the field to write to.
182:             * @param fieldOffset The offset of the field to write to.
183:             * @param newValue The value to write.
184:             */
185:            public void putIntVolatile(Object object, long fieldOffset,
186:                    int newValue) {
187:                return;
188:            }
189:
190:            /**
191:             * <p>
192:             * Reads an int value from an Object's field as though it were declared
193:             * <code>volatile</code>.
194:             * </p>
195:             * 
196:             * @param object The instance containing the field to read from.
197:             * @param fieldOffset The offset of the field to read from.
198:             * @return The value that was read.
199:             */
200:            public int getIntVolatile(Object object, long fieldOffset) {
201:                return 0;
202:            }
203:
204:            /**
205:             * <p>
206:             * Writes a long value to an Object's field as though it were declared
207:             * <code>volatile</code>.
208:             * </p>
209:             * 
210:             * @param object The instance containing the field to write to.
211:             * @param fieldOffset The offset of the field to write to.
212:             * @param newValue The value to write.
213:             */
214:            public void putLongVolatile(Object object, long fieldOffset,
215:                    long newValue) {
216:                return;
217:            }
218:
219:            /**
220:             * <p>
221:             * Reads a long value from an Object's field as though it were declared
222:             * <code>volatile</code>.
223:             * </p>
224:             * 
225:             * @param object The instance containing the field to read from.
226:             * @param fieldOffset The offset of the field to read from.
227:             * @return The value that was read.
228:             */
229:            public long getLongVolatile(Object object, long fieldOffset) {
230:                return 0;
231:            }
232:
233:            /**
234:             * <p>
235:             * Writes an Object reference value to an Object's field as though it were
236:             * declared <code>volatile</code>.
237:             * </p>
238:             * 
239:             * @param object The instance containing the field to write to.
240:             * @param fieldOffset The offset of the field to write to.
241:             * @param newValue The value to write.
242:             */
243:            public void putObjectVolatile(Object object, long fieldOffset,
244:                    Object newValue) {
245:                return;
246:            }
247:
248:            /**
249:             * <p>
250:             * Writes an int value to an Object's field as though it were declared
251:             * <code>volatile</code>.
252:             * </p>
253:             * 
254:             * @param object The instance containing the field to write to.
255:             * @param fieldOffset The offset of the field to write to.
256:             * @param newValue The value to write.
257:             */
258:            public Object getObjectVolatile(Object object, long fieldOffset) {
259:                return null;
260:            }
261:
262:            /**
263:             * <p>
264:             * Writes a long value to an Object's field.
265:             * </p>
266:             * 
267:             * @param object The instance containing the field to write to.
268:             * @param fieldOffset The offset of the field to write to.
269:             * @param newValue The value to write.
270:             */
271:            public void putLong(Object object, long fieldOffset, long newValue) {
272:                return;
273:            }
274:
275:            /**
276:             * <p>
277:             * Reads a long value from an Object's field.
278:             * </p>
279:             * 
280:             * @param object The instance containing the field to read from.
281:             * @param fieldOffset The offset of the field to read from.
282:             * @return The value that was read.
283:             */
284:            public long getLong(Object object, long fieldOffset) {
285:                return 0L;
286:            }
287:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.