org.apache.bcel.classfile.Method.accept()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(84)

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

Method.accept介绍

[英]Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
[中]由遍历由Java类的内容隐式定义的树的节点的对象调用。也就是说,方法、字段、属性等的层次结构生成了一个对象树。

代码示例

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

public void doVisitMethod(Method method) {
  if (visitingMethod) {
    throw new IllegalStateException("doVisitMethod called when already visiting a method");
  }
  visitingMethod = true;
  try {
    this.method = method;
    methodName = methodSig = dottedMethodSig = fullyQualifiedMethodName = null;
    thisMethodInfo = (MethodInfo) thisClassInfo.findMethod(getMethodName(), getMethodSig(), method.isStatic());
    assert thisMethodInfo != null : "Can't get method info for " + getFullyQualifiedMethodName();
    this.method.accept(this);
    Attribute[] attributes = method.getAttributes();
    for (Attribute attribute : attributes) {
      attribute.accept(this);
    }
  } finally {
    visitingMethod = false;
    this.method = null;
    this.thisMethodInfo = null;
  }
}

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

public void visitMethod(Method method) {
 stack.push(method);
 method.accept(visitor);
 
 Attribute[] attributes = method.getAttributes();
 for(int i=0; i < attributes.length; i++)
  attributes[i].accept(this);
 stack.pop();
}

代码示例来源:origin: org.apache.bcel/bcel

@Override
public void visitMethod(final Method method)
{
  stack.push(method);
  method.accept(visitor);
  final Attribute[] attributes = method.getAttributes();
  for (final Attribute attribute : attributes) {
    attribute.accept(this);
  }
  stack.pop();
}

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

_out.println("  private void createMethod_" + i + "() {");   
methods[i].accept(this);
_out.println("  }\n");

代码示例来源:origin: org.apache.bcel/bcel

for (int i = 0; i < methods.length; i++) {
  _out.println("  private void createMethod_" + i + "() {");
  methods[i].accept(this);
  _out.println("  }");
  _out.println();

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

public void visitJavaClass(JavaClass clazz) {
 stack.push(clazz);
 clazz.accept(visitor);
 Field[] fields = clazz.getFields();
 for(int i=0; i < fields.length; i++)
  fields[i].accept(this);
 Method[] methods = clazz.getMethods();
 for(int i=0; i < methods.length; i++)
  methods[i].accept(this);
 Attribute[] attributes = clazz.getAttributes();
 for(int i=0; i < attributes.length; i++)
  attributes[i].accept(this);
 clazz.getConstantPool().accept(this);
 stack.pop();
}

代码示例来源:origin: org.apache.bcel/bcel

@Override
public void visitJavaClass(final JavaClass _clazz)
{
  stack.push(_clazz);
  _clazz.accept(visitor);
  final Field[] fields = _clazz.getFields();
  for (final Field field : fields) {
    field.accept(this);
  }
  final Method[] methods = _clazz.getMethods();
  for (final Method method : methods) {
    method.accept(this);
  }
  final Attribute[] attributes = _clazz.getAttributes();
  for (final Attribute attribute : attributes) {
    attribute.accept(this);
  }
  _clazz.getConstantPool().accept(this);
  stack.pop();
}

代码示例来源:origin: com.google.code.findbugs/findbugs

public void doVisitMethod(Method method) {
  if (visitingMethod) {
    throw new IllegalStateException("doVisitMethod called when already visiting a method");
  }
  visitingMethod = true;
  try {
    this.method = method;
    methodName = methodSig = dottedMethodSig = fullyQualifiedMethodName = null;
    thisMethodInfo = (MethodInfo) thisClassInfo.findMethod(getMethodName(), getMethodSig(), method.isStatic());
    assert thisMethodInfo != null : "Can't get method info for " + getFullyQualifiedMethodName();
    this.method.accept(this);
    Attribute[] attributes = method.getAttributes();
    for (Attribute attribute : attributes) {
      attribute.accept(this);
    }
  } finally {
    visitingMethod = false;
    this.method = null;
    this.thisMethodInfo = null;
  }
}

相关文章