1 /*
  2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 
 26 package jdk.internal.reflect;
 27 
 28 import jdk.internal.vm.annotation.Stable;
 29 
 30 import java.lang.reflect.Field;
 31 
 32 /** Package-private implementation of the FieldAccessor interface
 33     which has access to all classes and all fields, regardless of
 34     language restrictions. See MagicAccessorImpl. */
 35 
 36 abstract class FieldAccessorImpl extends MagicAccessorImpl
 37     implements FieldAccessor {
 38     @Stable
 39     protected final Field field;
 40 
 41     FieldAccessorImpl(Field field) {
 42         this.field = field;
 43     }
 44 
 45     /** Matches specification in {@link java.lang.reflect.Field} */
 46     public abstract Object get(Object obj)
 47         throws IllegalArgumentException;
 48 
 49     /** Matches specification in {@link java.lang.reflect.Field} */
 50     public abstract boolean getBoolean(Object obj)
 51         throws IllegalArgumentException;
 52 
 53     /** Matches specification in {@link java.lang.reflect.Field} */
 54     public abstract byte getByte(Object obj)
 55         throws IllegalArgumentException;
 56 
 57     /** Matches specification in {@link java.lang.reflect.Field} */
 58     public abstract char getChar(Object obj)
 59         throws IllegalArgumentException;
 60 
 61     /** Matches specification in {@link java.lang.reflect.Field} */
 62     public abstract short getShort(Object obj)
 63         throws IllegalArgumentException;
 64 
 65     /** Matches specification in {@link java.lang.reflect.Field} */
 66     public abstract int getInt(Object obj)
 67         throws IllegalArgumentException;
 68 
 69     /** Matches specification in {@link java.lang.reflect.Field} */
 70     public abstract long getLong(Object obj)
 71         throws IllegalArgumentException;
 72 
 73     /** Matches specification in {@link java.lang.reflect.Field} */
 74     public abstract float getFloat(Object obj)
 75         throws IllegalArgumentException;
 76 
 77     /** Matches specification in {@link java.lang.reflect.Field} */
 78     public abstract double getDouble(Object obj)
 79         throws IllegalArgumentException;
 80 
 81     /** Matches specification in {@link java.lang.reflect.Field} */
 82     public abstract void set(Object obj, Object value)
 83         throws IllegalArgumentException, IllegalAccessException;
 84 
 85     /** Matches specification in {@link java.lang.reflect.Field} */
 86     public abstract void setBoolean(Object obj, boolean z)
 87         throws IllegalArgumentException, IllegalAccessException;
 88 
 89     /** Matches specification in {@link java.lang.reflect.Field} */
 90     public abstract void setByte(Object obj, byte b)
 91         throws IllegalArgumentException, IllegalAccessException;
 92 
 93     /** Matches specification in {@link java.lang.reflect.Field} */
 94     public abstract void setChar(Object obj, char c)
 95         throws IllegalArgumentException, IllegalAccessException;
 96 
 97     /** Matches specification in {@link java.lang.reflect.Field} */
 98     public abstract void setShort(Object obj, short s)
 99         throws IllegalArgumentException, IllegalAccessException;
100 
101     /** Matches specification in {@link java.lang.reflect.Field} */
102     public abstract void setInt(Object obj, int i)
103         throws IllegalArgumentException, IllegalAccessException;
104 
105     /** Matches specification in {@link java.lang.reflect.Field} */
106     public abstract void setLong(Object obj, long l)
107         throws IllegalArgumentException, IllegalAccessException;
108 
109     /** Matches specification in {@link java.lang.reflect.Field} */
110     public abstract void setFloat(Object obj, float f)
111         throws IllegalArgumentException, IllegalAccessException;
112 
113     /** Matches specification in {@link java.lang.reflect.Field} */
114     public abstract void setDouble(Object obj, double d)
115         throws IllegalArgumentException, IllegalAccessException;
116 }