java.lang.NoSuchFieldException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中java.lang.NoSuchFieldException.toString()方法的一些代码示例,展示了NoSuchFieldException.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NoSuchFieldException.toString()方法的具体详情如下:
包路径:java.lang.NoSuchFieldException
类名称:NoSuchFieldException
方法名:toString

NoSuchFieldException.toString介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class jc = getJavaClass();
  try {
    return jc.getField(name).get(null);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class jc = getJavaClass();
  try {
    jc.getField(name).set(null, value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: apache/hbase

public DefaultMetricsSystemHelper() {
 Class<? extends DefaultMetricsSystem> clazz = DefaultMetricsSystem.INSTANCE.getClass();
 Method m;
 try {
  m = clazz.getDeclaredMethod("removeObjectName", String.class);
  m.setAccessible(true);
 } catch (NoSuchMethodException e) {
  m = null;
 }
 removeObjectMethod = m;
 Field f1, f2;
 try {
  f1 = clazz.getDeclaredField("sourceNames");
  f1.setAccessible(true);
  f2 = UniqueNames.class.getDeclaredField("map");
  f2.setAccessible(true);
 } catch (NoSuchFieldException e) {
  LOG.trace(e.toString(), e);
  f1 = null;
  f2 = null;
 }
 sourceNamesField = f1;
 mapField = f2;
}

代码示例来源:origin: redisson/redisson

/**
 * Is invoked when public fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class jc = getClassMetaobject().getJavaClass();
  try {
    jc.getField(name).set(getObject(), value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: redisson/redisson

/**
 * Is invoked when public fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class jc = getClassMetaobject().getJavaClass();
  try {
    return jc.getField(name).get(getObject());
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: org.javassist/javassist

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class<?> jc = getJavaClass();
  try {
    return jc.getField(name).get(null);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: org.javassist/javassist

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class<?> jc = getJavaClass();
  try {
    jc.getField(name).set(null, value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class<?> jc = getJavaClass();
  try {
    return jc.getField(name).get(null);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class jc = getJavaClass();
  try {
    return jc.getField(name).get(null);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class<?> jc = getJavaClass();
  try {
    jc.getField(name).set(null, value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when <code>static</code> fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class jc = getJavaClass();
  try {
    jc.getField(name).set(null, value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: org.javassist/javassist

/**
 * Is invoked when public fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class<?> jc = getClassMetaobject().getJavaClass();
  try {
    return jc.getField(name).get(getObject());
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: org.javassist/javassist

/**
 * Is invoked when public fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class<?> jc = getClassMetaobject().getJavaClass();
  try {
    jc.getField(name).set(getObject(), value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when public fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class<?> jc = getClassMetaobject().getJavaClass();
  try {
    jc.getField(name).set(getObject(), value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when public fields of the base-level
 * class are modified and the runtime system intercepts it.
 * This method simply sets the field to the given value.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public void trapFieldWrite(String name, Object value) {
  Class jc = getClassMetaobject().getJavaClass();
  try {
    jc.getField(name).set(getObject(), value);
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when public fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class<?> jc = getClassMetaobject().getJavaClass();
  try {
    return jc.getField(name).get(getObject());
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: scouter-project/scouter

/**
 * Is invoked when public fields of the base-level
 * class are read and the runtime system intercepts it.
 * This method simply returns the value of the field.
 *
 * <p>Every subclass of this class should redefine this method.
 */
public Object trapFieldRead(String name) {
  Class jc = getClassMetaobject().getJavaClass();
  try {
    return jc.getField(name).get(getObject());
  }
  catch (NoSuchFieldException e) {
    throw new RuntimeException(e.toString());
  }
  catch (IllegalAccessException e) {
    throw new RuntimeException(e.toString());
  }
}

代码示例来源:origin: douzifly/clear-todolist

private Field getIdField(Class<?> type) {
  if (type.equals(Model.class)) {
    try {
      return type.getDeclaredField("mId");
    }
    catch (NoSuchFieldException e) {
      Log.e("Impossible!", e.toString());
    }
  }
  else if (type.getSuperclass() != null) {
    return getIdField(type.getSuperclass());
  }
  return null;
}

代码示例来源:origin: shinado/jujuj

private Field getIdField(Class<?> type) {
  if (type.equals(Model.class)) {
    try {
      return type.getDeclaredField("mId");
    }
    catch (NoSuchFieldException e) {
      Log.e("Impossible!", e.toString());
    }
  }
  else if (type.getSuperclass() != null) {
    return getIdField(type.getSuperclass());
  }
  return null;
}

代码示例来源:origin: shinado/jujuj

private Field getIdField(Class<?> type) {
  if (type.equals(Model.class)) {
    try {
      return type.getDeclaredField("mId");
    }
    catch (NoSuchFieldException e) {
      Log.e("Impossible!", e.toString());
    }
  }
  else if (type.getSuperclass() != null) {
    return getIdField(type.getSuperclass());
  }
  return null;
}

相关文章