📄 field.java
字号:
* @see #get(Object) */ public native short getShort(Object o) throws IllegalAccessException; /** * Get the value of this Field as an int. If the field is static, * <code>o</code> will be ignored. * * @param o the object to get the value of this Field from * @return the value of the Field * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a byte, short, char, or * int field of <code>o</code>, or if <code>o</code> is not an * instance of the declaring class of this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #get(Object) */ public native int getInt(Object o) throws IllegalAccessException; /** * Get the value of this Field as a long. If the field is static, * <code>o</code> will be ignored. * * @param o the object to get the value of this Field from * @return the value of the Field * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a byte, short, char, int, * or long field of <code>o</code>, or if <code>o</code> is not an * instance of the declaring class of this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #get(Object) */ public native long getLong(Object o) throws IllegalAccessException; /** * Get the value of this Field as a float. If the field is static, * <code>o</code> will be ignored. * * @param o the object to get the value of this Field from * @return the value of the Field * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a byte, short, char, int, * long, or float field of <code>o</code>, or if <code>o</code> is * not an instance of the declaring class of this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #get(Object) */ public native float getFloat(Object o) throws IllegalAccessException; /** * Get the value of this Field as a double. If the field is static, * <code>o</code> will be ignored. * * @param o the object to get the value of this Field from * @return the value of the Field * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a byte, short, char, int, * long, float, or double field of <code>o</code>, or if * <code>o</code> is not an instance of the declaring class of this * field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #get(Object) */ public native double getDouble(Object o) throws IllegalAccessException; /** * Set the value of this Field. If it is a primitive field, the value * will be unwrapped from the passed object (boolean = java.lang.Boolean).<p> * * If the field is static, <code>o</code> will be ignored. Otherwise, if * <code>o</code> is null, you get a <code>NullPointerException</code>, * and if it is incompatible with the declaring class of the field, you * get an <code>IllegalArgumentException</code>.<p> * * Next, if this Field enforces access control, your runtime context is * evaluated, and you may have an <code>IllegalAccessException</code> if * you could not access this field in similar compiled code. This also * occurs whether or not there is access control if the field is final. * If the field is primitive, and unwrapping your argument fails, you will * get an <code>IllegalArgumentException</code>; likewise, this error * happens if <code>value</code> cannot be cast to the correct object type. * If the field is static, and its class is uninitialized, you trigger class * initialization, which may end in a * <code>ExceptionInInitializerError</code>.<p> * * Finally, the field is set with the widened value. This method accesses * the field of the declaring class, even if the instance passed in belongs * to a subclass which declares another field to hide this one. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if <code>value</code> cannot be * converted by a widening conversion to the underlying type of * the Field, or if <code>o</code> is not an instance of the class * declaring this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #setBoolean(Object, boolean) * @see #setByte(Object, byte) * @see #setChar(Object, char) * @see #setShort(Object, short) * @see #setInt(Object, int) * @see #setLong(Object, long) * @see #setFloat(Object, float) * @see #setDouble(Object, double) */ public native void set(Object o, Object value) throws IllegalAccessException; /** * Set this boolean Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a boolean field, or if * <code>o</code> is not an instance of the class declaring this * field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setBoolean(Object o, boolean value) throws IllegalAccessException; /** * Set this byte Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a byte, short, int, long, * float, or double field, or if <code>o</code> is not an instance * of the class declaring this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setByte(Object o, byte value) throws IllegalAccessException; /** * Set this char Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a char, int, long, * float, or double field, or if <code>o</code> is not an instance * of the class declaring this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setChar(Object o, char value) throws IllegalAccessException; /** * Set this short Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a short, int, long, * float, or double field, or if <code>o</code> is not an instance * of the class declaring this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setShort(Object o, short value) throws IllegalAccessException; /** * Set this int Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not an int, long, float, or * double field, or if <code>o</code> is not an instance of the * class declaring this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setInt(Object o, int value) throws IllegalAccessException; /** * Set this long Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a long, float, or double * field, or if <code>o</code> is not an instance of the class * declaring this field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setLong(Object o, long value) throws IllegalAccessException; /** * Set this float Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a float or long field, or * if <code>o</code> is not an instance of the class declaring this * field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setFloat(Object o, float value) throws IllegalAccessException; /** * Set this double Field. If the field is static, <code>o</code> will be * ignored. * * @param o the object to set this Field on * @param value the value to set this Field to * @throws IllegalAccessException if you could not normally access this field * (i.e. it is not public) * @throws IllegalArgumentException if this is not a double field, or if * <code>o</code> is not an instance of the class declaring this * field * @throws NullPointerException if <code>o</code> is null and this field * requires an instance * @throws ExceptionInInitializerError if accessing a static field triggered * class initialization, which then failed * @see #set(Object, Object) */ public native void setDouble(Object o, double value) throws IllegalAccessException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -