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

📄 field.java

📁 java virtual machince kaffe
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    setCharInternal(o, 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  {    checkFinal();    setShortInternal(o, 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  {    checkFinal();    setIntInternal(o, 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  {    checkFinal();    setLongInternal(o, 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  {    checkFinal();    setFloatInternal(o, 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  {    checkFinal();    setDoubleInternal(o, value);  }  /**   * Return the generic type of the field. If the field type is not a generic   * type, the method returns the same as <code>getType()</code>.   *   * @throws GenericSignatureFormatError if the generic signature does   *         not conform to the format specified in the Virtual Machine   *         specification, version 3.   * @since 1.5   */  public Type getGenericType()  {    String signature = getSignature();    if (signature == null)      return getType();    FieldSignatureParser p = new FieldSignatureParser(getDeclaringClass(),                                                      signature);    return p.getFieldType();  }  /**   * Return the String in the Signature attribute for this field. If there   * is no Signature attribute, return null.   */  private native String getSignature();  /* The following code has been merged in from Kaffe's Field.java implementation */  /*   * Java core library component.   *   * Copyright (c) 1997, 1998, 2001   *      Transvirtual Technologies, Inc.  All rights reserved.   *   * Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006   *      Kaffe.org contributors. See ChangeLogs for details.   *   * See the file "license.terms" for information on usage and redistribution   * of this file.   */  private void setInternal(Object obj, Object value)     throws IllegalArgumentException, IllegalAccessException   {    if (type.isPrimitive()) {      if (value instanceof Boolean) {	setBooleanInternal(obj, ((Boolean)value).booleanValue());      }      else if (value instanceof Byte) {	setByteInternal(obj, ((Byte)value).byteValue());      }      else if (value instanceof Short) {	setShortInternal(obj, ((Short)value).shortValue());      }      else if (value instanceof Character) {	setCharInternal(obj, ((Character)value).charValue());      }      else if (value instanceof Integer) {	setIntInternal(obj, ((Integer)value).intValue());      }      else if (value instanceof Long) {	setLongInternal(obj, ((Long)value).longValue());      }      else if (value instanceof Float) {	setFloatInternal(obj, ((Float)value).floatValue());      }      else {	setDoubleInternal(obj, ((Double)value).doubleValue());      }    }    else {      if (value!=null && !type.isInstance(value)) {	throw new IllegalArgumentException("field type mismatch: Trying to assign a " 					   + value.getClass().getName() 					   + " to " + toString());      }      setObject0(obj, value);    }  }  public void setBooleanInternal(Object obj, boolean z)     throws IllegalArgumentException, IllegalAccessException   {    if (type == Boolean.TYPE)      setBoolean0(obj, z);    else      throw new IllegalArgumentException();  }  public void setByteInternal(Object obj, byte b)    throws IllegalArgumentException, IllegalAccessException  {    if (type == Byte.TYPE)      setByte0(obj, b);    else       setShortInternal(obj, b);  }  public void setCharInternal(Object obj, char c)     throws IllegalArgumentException, IllegalAccessException   {    if (type == Character.TYPE)      setChar0(obj, c);    else      setIntInternal(obj, c);  }  public void setDoubleInternal(Object obj, double d)     throws IllegalArgumentException, IllegalAccessException   {    if (type == Double.TYPE)      setDouble0(obj, d);    else      throw new IllegalArgumentException();  }  public void setFloatInternal(Object obj, float f)    throws IllegalArgumentException, IllegalAccessException   {    if (type == Float.TYPE)      setFloat0(obj, f);    else      setDoubleInternal(obj, f);  }  public void setIntInternal(Object obj, int i)    throws IllegalArgumentException, IllegalAccessException   {    if (type == Integer.TYPE)      setInt0(obj, i);    else      setLongInternal(obj, i);  }  public void setLongInternal(Object obj, long l)    throws IllegalArgumentException, IllegalAccessException   {    if (type == Long.TYPE)      setLong0(obj, l);    else      setFloatInternal(obj, l);  }  public void setShortInternal(Object obj, short s)    throws IllegalArgumentException, IllegalAccessException  {    if (type == Short.TYPE)      setShort0(obj, s);    else      setIntInternal(obj, s);  }  private void checkFinal()    throws IllegalAccessException  {    if (Modifier.isFinal(getModifiers()) && !flag)     {	throw new IllegalAccessException("trying to set final field " 					 + toString());    }  }  private native boolean getBoolean0(Object obj);  private native byte getByte0(Object obj);  private native char getChar0(Object obj);  private native short getShort0(Object obj);  private native int getInt0(Object obj);  private native long getLong0(Object obj);  private native float getFloat0(Object obj);  private native double getDouble0(Object obj);  private native Object getObject0(Object obj);    private native void setBoolean0(Object obj, boolean v);  private native void setByte0(Object obj, byte v);  private native void setChar0(Object obj, char v);  private native void setShort0(Object obj, short v);  private native void setInt0(Object obj, int v);  private native void setLong0(Object obj, long v);  private native void setFloat0(Object obj, float v);  private native void setDouble0(Object obj, double v);  private native void setObject0(Object obj, Object v);}

⌨️ 快捷键说明

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