⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 field.java

📁 JamVM是一种很优秀的嵌入式Java虚拟机
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   * <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 int getInt(Object o)    throws IllegalAccessException {        return getIField(o, declaringClass, type, slot, flag, 5);    }  /**   * 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 long getLong(Object o)    throws IllegalAccessException {        return getJField(o, declaringClass, type, slot, flag, 7);    }  /**   * 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 float getFloat(Object o)    throws IllegalAccessException {        return getFField(o, declaringClass, type, slot, flag, 6);    }  /**   * 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 double getDouble(Object o)    throws IllegalAccessException {        return getDField(o, declaringClass, type, slot, flag, 8);    }  /**   * 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 void set(Object o, Object value) throws IllegalAccessException {    setField(o, declaringClass, type, slot, flag, value);  }  private native void setField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, 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 void setBoolean(Object o, boolean value) throws IllegalAccessException {      setZField(o, declaringClass, type, slot, flag, 1, value);  }  /**   * 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 void setByte(Object o, byte value) throws IllegalAccessException {      setBField(o, declaringClass, type, slot, flag, 2, value);  }  /**   * 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 void setChar(Object o, char value) throws IllegalAccessException {      setCField(o, declaringClass, type, slot, flag, 3, value);  }  /**   * 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 void setShort(Object o, short value) throws IllegalAccessException {      setSField(o, declaringClass, type, slot, flag, 4, value);  }  /**   * 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 void setInt(Object o, int value) throws IllegalAccessException {      setIField(o, declaringClass, type, slot, flag, 5, value);  }  /**   * 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 void setLong(Object o, long value) throws IllegalAccessException {      setJField(o, declaringClass, type, slot, flag, 7, value);  }  /**   * 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 void setFloat(Object o, float value) throws IllegalAccessException {      setFField(o, declaringClass, type, slot, flag, 6, value);  }  /**   * 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 void setDouble(Object o, double value) throws IllegalAccessException {      setDField(o, declaringClass, type, slot, flag, 8, value);  }  private native double getDField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native int getIField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native long getJField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native boolean getZField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native float getFField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native char getCField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native short getSField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native byte getBField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no);  private native void setDField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, double v);  private native void setIField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, int i);  private native void setJField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, long j);  private native void setZField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, boolean z);  private native void setFField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, float f);  private native void setCField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, char c);  private native void setSField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, short s);  private native void setBField(Object o, Class declaringClass, Class type, int slot, boolean noAccessCheck, int type_no, byte b);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -