de.grogra.reflect
Class FieldBase
java.lang.Object
de.grogra.reflect.MemberBase
de.grogra.reflect.FieldBase
- All Implemented Interfaces:
- Field, Member
- Direct Known Subclasses:
- XField
public abstract class FieldBase
- extends MemberBase
- implements Field
Fields inherited from interface de.grogra.reflect.Member |
ABSTRACT, ACCESS_MODIFIERS, ARRAY, BRIDGE, CONSTANT, FINAL, INTERFACE, JAVA_MODIFIERS, LOCAL_CLASS, MIN_UNUSED_MODIFIER, NATIVE, PRIVATE, PROTECTED, PUBLIC, STATIC, STRICT, SYNCHRONIZED, SYNTHETIC, TRANSIENT, VARARGS, VOLATILE |
Constructor Summary |
FieldBase(java.lang.String name,
int modifiers,
Type declaringType,
Type type)
|
Method Summary |
boolean |
getBoolean(java.lang.Object object)
|
byte |
getByte(java.lang.Object object)
|
char |
getChar(java.lang.Object object)
|
java.lang.String |
getDescriptor()
Returns a descriptor for this member. |
double |
getDouble(java.lang.Object object)
|
float |
getFloat(java.lang.Object object)
|
int |
getInt(java.lang.Object object)
|
long |
getLong(java.lang.Object object)
|
java.lang.Object |
getObject(java.lang.Object object)
|
short |
getShort(java.lang.Object object)
|
Type |
getType()
|
void |
setBoolean(java.lang.Object object,
boolean value)
|
void |
setByte(java.lang.Object object,
byte value)
|
void |
setChar(java.lang.Object object,
char value)
|
void |
setDouble(java.lang.Object object,
double value)
|
void |
setFloat(java.lang.Object object,
float value)
|
void |
setInt(java.lang.Object object,
int value)
|
void |
setLong(java.lang.Object object,
long value)
|
void |
setObject(java.lang.Object object,
java.lang.Object value)
|
void |
setShort(java.lang.Object object,
short value)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
type
protected final Type type
FieldBase
public FieldBase(java.lang.String name,
int modifiers,
Type declaringType,
Type type)
getBoolean
public boolean getBoolean(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getBoolean
in interface Field
- Throws:
java.lang.IllegalAccessException
getByte
public byte getByte(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getByte
in interface Field
- Throws:
java.lang.IllegalAccessException
getChar
public char getChar(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getChar
in interface Field
- Throws:
java.lang.IllegalAccessException
getDescriptor
public java.lang.String getDescriptor()
- Description copied from interface:
Member
- Returns a descriptor for this member. Descriptors are constructed
as follows:
- For types, descriptors are defined as for the Java Virtual
Machine. For primitive types these are the single characters
'Z', 'B', 'S', 'C', 'I', 'J', 'F', 'D', 'V'
for
boolean
, byte
, short
,
char
, int
, long
,
float
, double
, void
.
For array types, the descriptor is the character '[' plus
the descriptor of its component type, e.g.,
[[I
for int[][]
. For non-array
reference types, the
descriptor is the character 'L', followed by the binary name
(see Type.getBinaryName()
) of the type, where '.'
has to be replaced by '/', followed by ';',
e.g., Ljava/lang/Object;
.
- For fields, the descriptor is the character 'f', followed by the
simple name of the field, followed by the character ';', followed
by the descriptor of the field's type. E.g.,
fout;Ljava/io/PrintStream;
for the field System.out
.
- For methods and constructors, the descriptor is the character
'm', followed by the simple name of the method (which is
<init>
for
constructors), followed by the characters ';' and '(', followed
by the descriptors of the method's parameter types, followed by
')', followed by the descriptor of the return type. E.g.
mprintln;(Ljava/lang/String;)V
for the method
PrintStream.println(String)
.
- Specified by:
getDescriptor
in interface Member
- Overrides:
getDescriptor
in class MemberBase
- Returns:
- the member's descriptor
getDouble
public double getDouble(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getDouble
in interface Field
- Throws:
java.lang.IllegalAccessException
getFloat
public float getFloat(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getFloat
in interface Field
- Throws:
java.lang.IllegalAccessException
getInt
public int getInt(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getInt
in interface Field
- Throws:
java.lang.IllegalAccessException
getLong
public long getLong(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getLong
in interface Field
- Throws:
java.lang.IllegalAccessException
getObject
public java.lang.Object getObject(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getObject
in interface Field
- Throws:
java.lang.IllegalAccessException
getShort
public short getShort(java.lang.Object object)
throws java.lang.IllegalAccessException
- Specified by:
getShort
in interface Field
- Throws:
java.lang.IllegalAccessException
getType
public final Type getType()
- Specified by:
getType
in interface Field
setBoolean
public void setBoolean(java.lang.Object object,
boolean value)
throws java.lang.IllegalAccessException
- Specified by:
setBoolean
in interface Field
- Throws:
java.lang.IllegalAccessException
setByte
public void setByte(java.lang.Object object,
byte value)
throws java.lang.IllegalAccessException
- Specified by:
setByte
in interface Field
- Throws:
java.lang.IllegalAccessException
setChar
public void setChar(java.lang.Object object,
char value)
throws java.lang.IllegalAccessException
- Specified by:
setChar
in interface Field
- Throws:
java.lang.IllegalAccessException
setDouble
public void setDouble(java.lang.Object object,
double value)
throws java.lang.IllegalAccessException
- Specified by:
setDouble
in interface Field
- Throws:
java.lang.IllegalAccessException
setFloat
public void setFloat(java.lang.Object object,
float value)
throws java.lang.IllegalAccessException
- Specified by:
setFloat
in interface Field
- Throws:
java.lang.IllegalAccessException
setInt
public void setInt(java.lang.Object object,
int value)
throws java.lang.IllegalAccessException
- Specified by:
setInt
in interface Field
- Throws:
java.lang.IllegalAccessException
setLong
public void setLong(java.lang.Object object,
long value)
throws java.lang.IllegalAccessException
- Specified by:
setLong
in interface Field
- Throws:
java.lang.IllegalAccessException
setObject
public void setObject(java.lang.Object object,
java.lang.Object value)
throws java.lang.IllegalAccessException
- Specified by:
setObject
in interface Field
- Throws:
java.lang.IllegalAccessException
setShort
public void setShort(java.lang.Object object,
short value)
throws java.lang.IllegalAccessException
- Specified by:
setShort
in interface Field
- Throws:
java.lang.IllegalAccessException
toString
public java.lang.String toString()
- Overrides:
toString
in class MemberBase