📄 field.html
字号:
public int <B>getInt</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Gets the value of a field as an <code>int</code> on the specified object. This method is equivalent to <code>((Number)get(obj)).intValue()</code>, except that an <code>IllegalArgumentException</code> is thrown if the field value cannot be converted to the type <code>int</code> by a widening conversion.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if the field value cannot be converted to the type <code>int</code> by a widening conversion.<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified object is null and the field is an instance field.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/Field.html#get(java.lang.Object)"><CODE>get(java.lang.Object)</CODE></A></DL></DD></DL><HR><A NAME="getLong(java.lang.Object)"><!-- --></A><H3>getLong</H3><PRE>public long <B>getLong</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Gets the value of a field as a <code>long</code> on the specified object. This method is equivalent to <code>((Number)get(obj)).longValue()</code>, except that an <code>IllegalArgumentException</code> is thrown if the field value cannot be converted to the type <code>long</code> by a widening conversion.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if the field value cannot be converted to the type <code>long</code> by a widening conversion.<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified object is null and the field is an instance field.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/Field.html#get(java.lang.Object)"><CODE>get(java.lang.Object)</CODE></A></DL></DD></DL><HR><A NAME="getFloat(java.lang.Object)"><!-- --></A><H3>getFloat</H3><PRE>public float <B>getFloat</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Gets the value of a field as a <code>float</code> on the specified object. This method is equivalent to <code>((Number)get(obj)).floatValue()</code>, except that an <code>IllegalArgumentException</code> is thrown if the field value cannot be converted to the type <code>float</code> by a widening conversion.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if the field value cannot be converted to the type <code>float</code> by a widening conversion.<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified object is null and the field is an instance field.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/Field.html#get(java.lang.Object)"><CODE>get(java.lang.Object)</CODE></A></DL></DD></DL><HR><A NAME="getDouble(java.lang.Object)"><!-- --></A><H3>getDouble</H3><PRE>public double <B>getDouble</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Gets the value of a field as a <code>double</code> on the specified object. This method is equivalent to <code>((Number)get(obj)).doubleValue()</code>, except that an <code>IllegalArgumentException</code> is thrown if the field value cannot be converted to the type <code>double</code> by a widening conversion.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if the field value cannot be converted to the type <code>double</code> by a widening conversion.<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified object is null and the field is an instance field.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/Field.html#get(java.lang.Object)"><CODE>get(java.lang.Object)</CODE></A></DL></DD></DL><HR><A NAME="set(java.lang.Object, java.lang.Object)"><!-- --></A><H3>set</H3><PRE>public void <B>set</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj, <A HREF="../../../java/lang/Object.html">Object</A> value) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Sets the field represented by this <code>Field</code> object on the specified object argument to the specified new value. The new value is automatically unwrapped if the underlying field has a primitive type. <p>The operation proceeds as follows: <p>If the underlying field is static, the <code>obj</code> argument is ignored; it may be null. <p>Otherwise the underlying field is an instance field. If the specified object argument is null, the method throws a <code>NullPointerException</code>. If the specified object argument is not an instance of the class or interface declaring the underlying field, the method throws an <code>IllegalArgumentException</code>. <p>If this <code>Field</code> object enforces Java language access control, and the underlying field is inaccessible, the method throws an <code>IllegalAccessException</code>. <p>If the underlying field is final, the method throws an <code>IllegalAccessException</code>. <p>If the underlying field is of a primitive type, an unwrapping conversion is attempted to convert the new value to a value of a primitive type. If this attempt fails, the method throws an <code>IllegalArgumentException</code>. <p>If, after possible unwrapping, the new value cannot be converted to the type of the underlying field by an identity or widening conversion, the method throws an <code>IllegalArgumentException</code>. <p>If the underlying field is static, the class that declared the field is initialized if it has not already been initialized. <p>The field is set to the possibly unwrapped and widened new value. <p>If the field is hidden in the type of <code>obj</code>, the field's value is set according to the preceding rules.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if an unwrapping conversion fails.<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified object is null and the field is an instance field.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.</DL></DD></DL><HR><A NAME="setBoolean(java.lang.Object, boolean)"><!-- --></A><H3>setBoolean</H3><PRE>public void <B>setBoolean</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj, boolean z) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Sets the value of a field as a <code>boolean</code> on the specified object. This method is equivalent to <code>set(obj, zObj)</code>, where <code>zObj</code> is a <code>Boolean</code> object and <code>zObj.booleanValue() == z</code>.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor is inaccessible.<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof), or if an unwrapping conversion fails.<DD><CODE><A HREF="../../../java/lang/NullPointerException.html">NullPointerException</A></CODE> - if the specified object is null and the field is an instance field.<DD><CODE><A HREF="../../../java/lang/ExceptionInInitializerError.html">ExceptionInInitializerError</A></CODE> - if the initialization provoked by this method fails.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/reflect/Field.html#set(java.lang.Object, java.lang.Object)"><CODE>set(java.lang.Object, java.lang.Object)</CODE></A></DL></DD></DL><HR><A NAME="setByte(java.lang.Object, byte)"><!-- --></A><H3>setByte</H3><PRE>public void <B>setByte</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj, byte b) throws <A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A>, <A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></PRE><DL><DD>Sets the value of a field as a <code>byte</code> on the specified object. This method is equivalent to <code>set(obj, bObj)</code>, where <code>bObj</code> is a <code>Byte</code> object and <code>bObj.byteValue() == b</code>.<DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalAccessException.html">IllegalAccessException</A></CODE> - if the underlying constructor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -