0N/A/*
2362N/A * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage sun.reflect;
0N/A
0N/Aimport java.lang.reflect.Field;
0N/A
0N/Aclass UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl {
0N/A UnsafeLongFieldAccessorImpl(Field field) {
0N/A super(field);
0N/A }
0N/A
0N/A public Object get(Object obj) throws IllegalArgumentException {
0N/A return new Long(getLong(obj));
0N/A }
0N/A
0N/A public boolean getBoolean(Object obj) throws IllegalArgumentException {
0N/A throw newGetBooleanIllegalArgumentException();
0N/A }
0N/A
0N/A public byte getByte(Object obj) throws IllegalArgumentException {
0N/A throw newGetByteIllegalArgumentException();
0N/A }
0N/A
0N/A public char getChar(Object obj) throws IllegalArgumentException {
0N/A throw newGetCharIllegalArgumentException();
0N/A }
0N/A
0N/A public short getShort(Object obj) throws IllegalArgumentException {
0N/A throw newGetShortIllegalArgumentException();
0N/A }
0N/A
0N/A public int getInt(Object obj) throws IllegalArgumentException {
0N/A throw newGetIntIllegalArgumentException();
0N/A }
0N/A
0N/A public long getLong(Object obj) throws IllegalArgumentException {
0N/A ensureObj(obj);
0N/A return unsafe.getLong(obj, fieldOffset);
0N/A }
0N/A
0N/A public float getFloat(Object obj) throws IllegalArgumentException {
0N/A return getLong(obj);
0N/A }
0N/A
0N/A public double getDouble(Object obj) throws IllegalArgumentException {
0N/A return getLong(obj);
0N/A }
0N/A
0N/A public void set(Object obj, Object value)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A ensureObj(obj);
0N/A if (isFinal) {
0N/A throwFinalFieldIllegalAccessException(value);
0N/A }
0N/A if (value == null) {
0N/A throwSetIllegalArgumentException(value);
0N/A }
0N/A if (value instanceof Byte) {
0N/A unsafe.putLong(obj, fieldOffset, ((Byte) value).byteValue());
0N/A return;
0N/A }
0N/A if (value instanceof Short) {
0N/A unsafe.putLong(obj, fieldOffset, ((Short) value).shortValue());
0N/A return;
0N/A }
0N/A if (value instanceof Character) {
0N/A unsafe.putLong(obj, fieldOffset, ((Character) value).charValue());
0N/A return;
0N/A }
0N/A if (value instanceof Integer) {
0N/A unsafe.putLong(obj, fieldOffset, ((Integer) value).intValue());
0N/A return;
0N/A }
0N/A if (value instanceof Long) {
0N/A unsafe.putLong(obj, fieldOffset, ((Long) value).longValue());
0N/A return;
0N/A }
0N/A throwSetIllegalArgumentException(value);
0N/A }
0N/A
0N/A public void setBoolean(Object obj, boolean z)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A throwSetIllegalArgumentException(z);
0N/A }
0N/A
0N/A public void setByte(Object obj, byte b)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A setLong(obj, b);
0N/A }
0N/A
0N/A public void setChar(Object obj, char c)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A setLong(obj, c);
0N/A }
0N/A
0N/A public void setShort(Object obj, short s)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A setLong(obj, s);
0N/A }
0N/A
0N/A public void setInt(Object obj, int i)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A setLong(obj, i);
0N/A }
0N/A
0N/A public void setLong(Object obj, long l)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A ensureObj(obj);
0N/A if (isFinal) {
0N/A throwFinalFieldIllegalAccessException(l);
0N/A }
0N/A unsafe.putLong(obj, fieldOffset, l);
0N/A }
0N/A
0N/A public void setFloat(Object obj, float f)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A throwSetIllegalArgumentException(f);
0N/A }
0N/A
0N/A public void setDouble(Object obj, double d)
0N/A throws IllegalArgumentException, IllegalAccessException
0N/A {
0N/A throwSetIllegalArgumentException(d);
0N/A }
0N/A}