Java Code Examples for org.apache.bcel.classfile.Visitor

The following examples show how to use org.apache.bcel.classfile.Visitor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * @see org.apache.bcel.classfile.Visitor#visitCode
 */
public void visitCode(Code aCode)
{   
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aCode.accept(v);
    }
    
    // perform a deep visit
    final byte[] code = aCode.getCode();
    final InstructionList list = new InstructionList(code);
    final Iterator it = list.iterator();
    for (Iterator iter = list.iterator(); iter.hasNext();) {
        InstructionHandle instruction = (InstructionHandle) iter.next();
        visitInstructionHandle(instruction);
    }
}
 
Example 2
/**
 * @see org.apache.bcel.classfile.Visitor#visitCode
 */
public void visitCode(Code aCode)
{   
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aCode.accept(v);
    }
    
    // perform a deep visit
    final byte[] code = aCode.getCode();
    final InstructionList list = new InstructionList(code);
    final Iterator it = list.iterator();
    for (Iterator iter = list.iterator(); iter.hasNext();) {
        InstructionHandle instruction = (InstructionHandle) iter.next();
        visitInstructionHandle(instruction);
    }
}
 
Example 3
/**
 * Deep visit of an InstructionHandle
 * @param aInstruction the InstructionHandle
 */
private void visitInstructionHandle(InstructionHandle aInstruction)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        final IDeepVisitor visitor = (IDeepVisitor) iter.next();
        org.apache.bcel.generic.Visitor v =
            visitor.getGenericVisitor();
        aInstruction.accept(v);
    }
}
 
Example 4
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitConstantPool(ConstantPool aConstantPool)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aConstantPool.accept(v);
    }
}
 
Example 5
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitField(Field aField)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aField.accept(v);
    }
}
 
Example 6
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitJavaClass(JavaClass aJavaClass)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aJavaClass.accept(v);
    }
}
 
Example 7
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitLocalVariableTable(LocalVariableTable aTable)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aTable.accept(v);
    }
}
 
Example 8
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitMethod(Method aMethod)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aMethod.accept(v);
    }
}
 
Example 9
/**
 * Deep visit of an InstructionHandle
 * @param aInstruction the InstructionHandle
 */
private void visitInstructionHandle(InstructionHandle aInstruction)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        final IDeepVisitor visitor = (IDeepVisitor) iter.next();
        org.apache.bcel.generic.Visitor v =
            visitor.getGenericVisitor();
        aInstruction.accept(v);
    }
}
 
Example 10
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitConstantPool(ConstantPool aConstantPool)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aConstantPool.accept(v);
    }
}
 
Example 11
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitField(Field aField)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aField.accept(v);
    }
}
 
Example 12
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitJavaClass(JavaClass aJavaClass)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aJavaClass.accept(v);
    }
}
 
Example 13
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitLocalVariableTable(LocalVariableTable aTable)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aTable.accept(v);
    }
}
 
Example 14
/**
 * @see org.apache.bcel.classfile.Visitor
 */
public void visitMethod(Method aMethod)
{
    for (Iterator iter = mVisitors.iterator(); iter.hasNext();) {
        IDeepVisitor visitor = (IDeepVisitor) iter.next();
        Visitor v = visitor.getClassFileVisitor();
        aMethod.accept(v);
    }
}
 
Example 15
/**
 * Gets the visitor for a parse tree walk.
 * @return the visitor for a parse tree walk.
 */
private Visitor getTreeVisitor()
{
    return new VisitorSet(mTreeVisitors);
}
 
Example 16
/**
 * Sets a visitor to be accepted during a traversal.
 * @param aVisitor the visitor to be accepted during a traversal.
 */
public void setVisitor(Visitor aVisitor)
{
    mVisitor = aVisitor;
}
 
Example 17
/**
 * Gets the visitor for a parse tree walk.
 * @return the visitor for a parse tree walk.
 */
private Visitor getTreeVisitor()
{
    return new VisitorSet(mTreeVisitors);
}
 
Example 18
/**
 * Sets a visitor to be accepted during a traversal.
 * @param aVisitor the visitor to be accepted during a traversal.
 */
public void setVisitor(Visitor aVisitor)
{
    mVisitor = aVisitor;
}