2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package java.lang.reflect;
20 import java.lang.annotation.Annotation;
22 public final class Field extends AccessibleObject implements Member {
23 int regIdx; // the link to the corresponding FieldInfo
24 String name; // deferred set by the NativePeer getName()
26 public String toGenericString() {
27 // TODO: return real generic string
31 public native boolean getBoolean (Object o) throws IllegalAccessException;
32 public native void setBoolean (Object o, boolean v) throws IllegalAccessException;
34 public native byte getByte (Object o) throws IllegalAccessException;
35 public native void setByte (Object o, byte v) throws IllegalAccessException;
37 public native short getShort (Object o) throws IllegalAccessException;
38 public native void setShort (Object o, short v) throws IllegalAccessException;
40 public native char getChar (Object o) throws IllegalAccessException;
41 public native void setChar (Object o, char v) throws IllegalAccessException;
43 public native int getInt (Object o) throws IllegalAccessException;
44 public native void setInt (Object o, int val) throws IllegalAccessException;
46 public native long getLong (Object o) throws IllegalAccessException;
47 public native void setLong (Object o, long v) throws IllegalAccessException;
49 public native float getFloat (Object o) throws IllegalAccessException;
50 public native void setFloat (Object o, float v) throws IllegalAccessException;
52 public native double getDouble (Object o) throws IllegalAccessException;
53 public native void setDouble (Object o, double v) throws IllegalAccessException;
55 public native Class<?> getType ();
57 public native Object get (Object o) throws IllegalAccessException;
59 public native void set (Object o, Object v) throws IllegalArgumentException, IllegalAccessException;
60 // the member interface
62 public native String getName();
65 public native int getModifiers();
68 public native Annotation[] getAnnotations();
71 public native <T extends Annotation> T getAnnotation( Class<T> annotationCls);
74 public native Class<?> getDeclaringClass ();
77 public native boolean isSynthetic ();
80 public native boolean equals (Object obj);
83 public native String toString ();
85 public boolean isEnumConstant (){
86 return (getModifiers() & Modifier.ENUM) != 0;
90 public native int hashCode ();
93 public native Annotation[] getDeclaredAnnotations ();