Java in a Nutshell, 5th Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java in a Nutshell, 5th Edition [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Fieldjava.lang.reflect

Java 1.1

This class represents a field of a
class. Instances of Field are obtained by calling
the getField( ) and related
methods of java.lang.Class.
Field implements the Member
interface, so once you have obtained a Field
object, you can use getName(
)
, getModifiers( ),
and getdeclaringClass( ) to determine the name,
modifiers, and class of the field. Additionally, getType(
) returns the type of the field.

The set( ) method
sets the value of the represented field for a specified object. (If
the represented field is static, no object need be
specified, of course.) If the field is of a
primitive type, its value can be specified using a wrapper object of
type Boolean, Integer, and so
on, or it can be set using the setBoolean( ),
setInt( ), and related methods. Similarly, the
get( ) method queries the value of the represented
field for a specified object and returns the field value as an
Object. Various other methods query the field
value and return it as various primitive types.

In Java 5.0, Field
implements AnnotatedElement to support reflection
on field annotations. The new
getGenericType(
) method supports reflection on the generic
type of fields, and isEnumConstant(
) supports
fields of enum types.


Figure 10-93. java.lang.reflect.Field

public final class

Field extends AccessibleObject implements Member {
// No Constructor
// Public Instance Methods
public Object

get (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public boolean

getBoolean (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public byte

getByte (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public char

getChar (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public double

getDouble (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public float

getFloat (Object

obj )
throws IllegalArgumentException, IllegalAccessException;

5.0 public Type

getGenericType ( );
public int

getInt (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public long

getLong (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public short

getShort (Object

obj )
throws IllegalArgumentException, IllegalAccessException;
public Class<?>

getType ( );

5.0 public boolean

isEnumConstant ( );
public void

set (Object

obj , Object

value )
throws IllegalArgumentException, IllegalAccessException;
public void

setBoolean (Object

obj , boolean

z )
throws IllegalArgumentException, IllegalAccessException;
public void

setByte (Object

obj , byte

b )
throws IllegalArgumentException, IllegalAccessException;
public void

setChar (Object

obj , char

c )
throws IllegalArgumentException, IllegalAccessException;
public void

setDouble (Object

obj , double

d )
throws IllegalArgumentException, IllegalAccessException;
public void

setFloat (Object

obj , float

f )
throws IllegalArgumentException, IllegalAccessException;
public void

setInt (Object

obj , int

i )
throws IllegalArgumentException, IllegalAccessException;
public void

setLong (Object

obj , long

l )
throws IllegalArgumentException, IllegalAccessException;
public void

setShort (Object

obj , short

s )
throws IllegalArgumentException, IllegalAccessException;

5.0 public String

toGenericString ( );
// Methods Implementing Member
public Class<?>

getDeclaringClass ( );
public int

getModifiers ( );
public String

getName ( );

5.0 public boolean

isSynthetic ( );
// Public Methods Overriding AccessibleObject

5.0 public <T extends java.lang.annotation.Annotation> T

getAnnotation
(Class<T>

annotationClass );

5.0 public java.lang.annotation.Annotation[ ]

getDeclaredAnnotations ( );
// Public Methods Overriding Object
public boolean

equals (Object

obj );
public int

hashCode ( );
public String

toString ( );
}


Returned By


Class.{getDeclaredField( ),
getdeclaredFields( ), getField(
), getFields( )}


    / 1191