java.lang.reflect - Field Class

The java.lang.reflect.Field class provides information about, and dynamic access to, a single field of a class or an interface. The reflected field may be a class (static) field or an instance field. A Field permits widening conversions to occur during a get or set access operation, but throws an IllegalArgumentException if a narrowing conversion would occur.
Following is the declaration for java.lang.reflect.Field class −
public final class Field
   extends AccessibleObject
      implements Member

Compares this Field against the specified object.
Returns the value of the field represented by this Field, on the specified object.
Returns this element's annotation for the specified type if such an annotation is present, else null.
Gets the value of a static or instance boolean field.
Gets the value of a static or instance byte field.
Gets the value of a static or instance field of type char or of another primitive type convertible to type char via a widening conversion.
Returns all annotations that are directly present on this element.
Returns the Class object representing the class or interface that declares the field represented by this Field object.
Gets the value of a static or instance field of type double or of another primitive type convertible to type double via a widening conversion.
Gets the value of a static or instance field of type float or of another primitive type convertible to type float via a widening conversion.
Returns a Type object that represents the declared type for the field represented by this Field object.
Gets the value of a static or instance field of type int or of another primitive type convertible to type int via a widening conversion.
Gets the value of a static or instance field of type long or of another primitive type convertible to type long via a widening conversion.
Returns the Java language modifiers for the field represented by this Field object, as an integer.
RReturns the name of the field represented by this Field object.
Gets the value of a static or instance field of type short or of another primitive type convertible to type short via a widening conversion.
Returns a Class object that identifies the declared type for the field represented by this Field object.
Returns a hashcode for this Field.
Returns true if this field represents an element of an enumerated type; returns false otherwise.
This method returns true if the field represented by the current object is synthetic, else it returns false.
Sets the value of a field as a boolean on the specified object.
Sets the value of a field as a byte on the specified object.
Sets the value of a field as a char on the specified object.
Sets the value of a field as a double on the specified object.
Sets the value of a field as a float on the specified object.
Sets the value of a field as an int on the specified object.
Sets the value of a field as a long on the specified object.
Sets the value of a field as a short on the specified object.
Returns a string describing this Field, including its generic type.
Returns a string describing this Field.
This class inherits methods from the following classes −
java.lang.reflect.AccessibleObject
java.lang.Object
 Print
 Add Notes
 Bookmark this page