Package com.esotericsoftware.reflectasm

Examples of com.esotericsoftware.reflectasm.FieldAccess


     * @param fieldName 需要设置的值的属性
     * @param value 指定属性的值
     * @throws RuntimeException 如果对这个类使用反射失败或者指定的对象里面没有该属性
     */
    public static final void setFieldValue(Object host, String fieldName, int value) {
      FieldAccess access = FieldAccess.get(host.getClass());
      access.setInt(host, access.getIndex(fieldName), value);
    }
View Full Code Here


     * @param fieldName 需要设置的值的属性
     * @param value 指定属性的值
     * @throws RuntimeException 如果对这个类使用反射失败或者指定的对象里面没有该属性
     */
    public static final void setFieldValue(Object host, String fieldName, long value) {
      FieldAccess access = FieldAccess.get(host.getClass());
      access.setLong(host, access.getIndex(fieldName), value);
    }
View Full Code Here

     * @param fieldName 需要设置的值的属性
     * @param value 指定属性的值
     * @throws RuntimeException 如果对这个类使用反射失败或者指定的对象里面没有该属性
     */
    public static final void setFieldValue(Object host, String fieldName, short value) {
      FieldAccess access = FieldAccess.get(host.getClass());
      access.setShort(host, access.getIndex(fieldName), value);
    }
View Full Code Here

    }

    public void copy (Object original, Object copy) {
      try {
        if (accessIndex != -1) {
          FieldAccess access = (FieldAccess)FieldSerializer.this.access;
          access.set(copy, accessIndex, kryo.copy(access.get(original, accessIndex)));
        } else
          field.set(copy, kryo.copy(field.get(original)));
      } catch (IllegalAccessException ex) {
        throw new KryoException("Error accessing field: " + this + " (" + type.getName() + ")", ex);
      } catch (KryoException ex) {
View Full Code Here

  }

  public void copy (Object original, Object copy) {
    try {
      if (accessIndex != -1) {
        FieldAccess access = (FieldAccess)fieldSerializer.access;
        access.set(copy, accessIndex, kryo.copy(access.get(original, accessIndex)));
      } else
        setField(copy, kryo.copy(getField(original)));
    } catch (IllegalAccessException ex) {
      throw new KryoException("Error accessing field: " + this + " (" + type.getName() + ")", ex);
    } catch (KryoException ex) {
View Full Code Here

TOP

Related Classes of com.esotericsoftware.reflectasm.FieldAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.