001: /*
002: * Copyright 2004-2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package sun.reflect;
027:
028: import java.lang.reflect.Field;
029:
030: class UnsafeQualifiedObjectFieldAccessorImpl extends
031: UnsafeQualifiedFieldAccessorImpl {
032: UnsafeQualifiedObjectFieldAccessorImpl(Field field,
033: boolean isReadOnly) {
034: super (field, isReadOnly);
035: }
036:
037: public Object get(Object obj) throws IllegalArgumentException {
038: ensureObj(obj);
039: return unsafe.getObjectVolatile(obj, fieldOffset);
040: }
041:
042: public boolean getBoolean(Object obj)
043: throws IllegalArgumentException {
044: throw newGetBooleanIllegalArgumentException();
045: }
046:
047: public byte getByte(Object obj) throws IllegalArgumentException {
048: throw newGetByteIllegalArgumentException();
049: }
050:
051: public char getChar(Object obj) throws IllegalArgumentException {
052: throw newGetCharIllegalArgumentException();
053: }
054:
055: public short getShort(Object obj) throws IllegalArgumentException {
056: throw newGetShortIllegalArgumentException();
057: }
058:
059: public int getInt(Object obj) throws IllegalArgumentException {
060: throw newGetIntIllegalArgumentException();
061: }
062:
063: public long getLong(Object obj) throws IllegalArgumentException {
064: throw newGetLongIllegalArgumentException();
065: }
066:
067: public float getFloat(Object obj) throws IllegalArgumentException {
068: throw newGetFloatIllegalArgumentException();
069: }
070:
071: public double getDouble(Object obj) throws IllegalArgumentException {
072: throw newGetDoubleIllegalArgumentException();
073: }
074:
075: public void set(Object obj, Object value)
076: throws IllegalArgumentException, IllegalAccessException {
077: ensureObj(obj);
078: if (isReadOnly) {
079: throwFinalFieldIllegalAccessException(value);
080: }
081: if (value != null) {
082: if (!field.getType().isAssignableFrom(value.getClass())) {
083: throwSetIllegalArgumentException(value);
084: }
085: }
086: unsafe.putObjectVolatile(obj, fieldOffset, value);
087: }
088:
089: public void setBoolean(Object obj, boolean z)
090: throws IllegalArgumentException, IllegalAccessException {
091: throwSetIllegalArgumentException(z);
092: }
093:
094: public void setByte(Object obj, byte b)
095: throws IllegalArgumentException, IllegalAccessException {
096: throwSetIllegalArgumentException(b);
097: }
098:
099: public void setChar(Object obj, char c)
100: throws IllegalArgumentException, IllegalAccessException {
101: throwSetIllegalArgumentException(c);
102: }
103:
104: public void setShort(Object obj, short s)
105: throws IllegalArgumentException, IllegalAccessException {
106: throwSetIllegalArgumentException(s);
107: }
108:
109: public void setInt(Object obj, int i)
110: throws IllegalArgumentException, IllegalAccessException {
111: throwSetIllegalArgumentException(i);
112: }
113:
114: public void setLong(Object obj, long l)
115: throws IllegalArgumentException, IllegalAccessException {
116: throwSetIllegalArgumentException(l);
117: }
118:
119: public void setFloat(Object obj, float f)
120: throws IllegalArgumentException, IllegalAccessException {
121: throwSetIllegalArgumentException(f);
122: }
123:
124: public void setDouble(Object obj, double d)
125: throws IllegalArgumentException, IllegalAccessException {
126: throwSetIllegalArgumentException(d);
127: }
128: }
|