org.apache.bcel.classfile.Visitor Java Examples

The following examples show how to use org.apache.bcel.classfile.Visitor. 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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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 #10
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 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 #11
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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 #12
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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 #13
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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 #14
Source File: VisitorSet.java    From contribution with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @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 #15
Source File: JavaClassWalker.java    From contribution with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * 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 #16
Source File: ClassFileSetCheck.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Gets the visitor for a parse tree walk.
 * @return the visitor for a parse tree walk.
 */
private Visitor getTreeVisitor()
{
    return new VisitorSet(mTreeVisitors);
}
 
Example #17
Source File: ClassFileSetCheck.java    From contribution with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * 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
Source File: JavaClassWalker.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * 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;
}