Logo Search packages:      
Sourcecode: jamvm version File versions

java::lang::reflect::Field Class Reference

List of all members.


Detailed Description

The Field class represents a member variable of a class. It also allows dynamic access to a member, via reflection. This works for both static and instance fields. Operations on Field objects know how to do widening conversions, but throw IllegalArgumentException if a narrowing conversion would be necessary. You can query for information on this Field regardless of location, but get and set access may be limited by Java language access controls. If you can't do it in the compiler, you can't normally do it here either.

Note: This class returns and accepts types as Classes, even primitive types; there are Class types defined that represent each different primitive type. They are java.lang.Boolean.TYPE, java.lang.Byte.TYPE,, also available as boolean.class, byte.class, etc. These are not to be confused with the classes java.lang.Boolean, java.lang.Byte, etc., which are real classes.

Also note that this is not a serializable class. It is entirely feasible to make it serializable using the Externalizable interface, but this is on Sun, not me.

Author:
John Keiser

Eric Blake <ebb9@email.byu.edu>

See also:
Member

Class

Class::getField(String)

Class::getDeclaredField(String)

Class::getFields()

Class::getDeclaredFields()

Since:
1.1 updated to 1.4

Definition at line 79 of file Field.java.


Public Member Functions

boolean equals (Object o)
Object get (Object o) throws IllegalAccessException
boolean getBoolean (Object o) throws IllegalAccessException
byte getByte (Object o) throws IllegalAccessException
char getChar (Object o) throws IllegalAccessException
Class getDeclaringClass ()
double getDouble (Object o) throws IllegalAccessException
native int getFieldModifiers (int slot)
float getFloat (Object o) throws IllegalAccessException
int getInt (Object o) throws IllegalAccessException
long getLong (Object o) throws IllegalAccessException
int getModifiers ()
String getName ()
short getShort (Object o) throws IllegalAccessException
Class getType ()
int hashCode ()
void set (Object o, Object value) throws IllegalAccessException
void setBoolean (Object o, boolean value) throws IllegalAccessException
void setByte (Object o, byte value) throws IllegalAccessException
void setChar (Object o, char value) throws IllegalAccessException
void setDouble (Object o, double value) throws IllegalAccessException
void setFloat (Object o, float value) throws IllegalAccessException
void setInt (Object o, int value) throws IllegalAccessException
void setLong (Object o, long value) throws IllegalAccessException
void setShort (Object o, short value) throws IllegalAccessException
String toString ()

Private Member Functions

 Field (Class declaringClass, Class type, String name, int slot)
native byte getBField (Object o, Class declaringClass, Class type, int slot, int type_no)
native char getCField (Object o, Class declaringClass, Class type, int slot, int type_no)
native double getDField (Object o, Class declaringClass, Class type, int slot, int type_no)
native float getFField (Object o, Class declaringClass, Class type, int slot, int type_no)
native Object getField (Object o, Class declaringClass, Class type, int slot) throws IllegalAccessException
native int getIField (Object o, Class declaringClass, Class type, int slot, int type_no)
native long getJField (Object o, Class declaringClass, Class type, int slot, int type_no)
native short getSField (Object o, Class declaringClass, Class type, int slot, int type_no)
native boolean getZField (Object o, Class declaringClass, Class type, int slot, int type_no)
native void setBField (Object o, Class declaringClass, Class type, int slot, int type_no, byte b)
native void setCField (Object o, Class declaringClass, Class type, int slot, int type_no, char c)
native void setDField (Object o, Class declaringClass, Class type, int slot, int type_no, double v)
native void setFField (Object o, Class declaringClass, Class type, int slot, int type_no, float f)
native void setField (Object o, Class declaringClass, Class type, int slot, Object value) throws IllegalAccessException
native void setIField (Object o, Class declaringClass, Class type, int slot, int type_no, int i)
native void setJField (Object o, Class declaringClass, Class type, int slot, int type_no, long j)
native void setSField (Object o, Class declaringClass, Class type, int slot, int type_no, short s)
native void setZField (Object o, Class declaringClass, Class type, int slot, int type_no, boolean z)

Private Attributes

Class declaringClass
String name
int slot
Class type

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index