Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.bcel.util
Class BCELifier  view BCELifier download BCELifier.java

java.lang.Object
  extended byorg.apache.bcel.classfile.EmptyVisitor
      extended byorg.apache.bcel.util.BCELifier
All Implemented Interfaces:
org.apache.bcel.classfile.Visitor

public class BCELifier
extends org.apache.bcel.classfile.EmptyVisitor

This class takes a given JavaClass object and converts it to a Java program that creates that very class using BCEL. This gives new users of BCEL a useful example showing how things are done with BCEL. It does not cover all features of BCEL, but tries to mimic hand-written code as close as possible.

Version:
$Id: BCELifier.java 394939 2006-04-18 13:23:49Z tcurdt $

Field Summary
private  org.apache.bcel.classfile.JavaClass _clazz
           
private  org.apache.bcel.generic.ConstantPoolGen _cp
           
private  java.io.PrintWriter _out
           
private static int FLAG_FOR_CLASS
           
private static int FLAG_FOR_METHOD
           
private static int FLAG_FOR_UNKNOWN
           
 
Constructor Summary
BCELifier(org.apache.bcel.classfile.JavaClass clazz, java.io.OutputStream out)
           
 
Method Summary
static void main(java.lang.String[] argv)
          Default main method
(package private) static java.lang.String printArgumentTypes(org.apache.bcel.generic.Type[] arg_types)
           
private  void printCreate()
           
(package private) static java.lang.String printFlags(int flags)
           
(package private) static java.lang.String printFlags(int flags, int reason)
           
private  void printMain()
           
(package private) static java.lang.String printType(java.lang.String signature)
           
(package private) static java.lang.String printType(org.apache.bcel.generic.Type type)
           
 void start()
          Start Java code generation
 void visitField(org.apache.bcel.classfile.Field field)
           
 void visitJavaClass(org.apache.bcel.classfile.JavaClass clazz)
           
 void visitMethod(org.apache.bcel.classfile.Method method)
           
 
Methods inherited from class org.apache.bcel.classfile.EmptyVisitor
visitCode, visitCodeException, visitConstantClass, visitConstantDouble, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantLong, visitConstantMethodref, visitConstantNameAndType, visitConstantPool, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitExceptionTable, visitInnerClass, visitInnerClasses, visitLineNumber, visitLineNumberTable, visitLocalVariable, visitLocalVariableTable, visitSignature, visitSourceFile, visitStackMap, visitStackMapEntry, visitSynthetic, visitUnknown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLAG_FOR_UNKNOWN

private static final int FLAG_FOR_UNKNOWN
See Also:
Constant Field Values

FLAG_FOR_CLASS

private static final int FLAG_FOR_CLASS
See Also:
Constant Field Values

FLAG_FOR_METHOD

private static final int FLAG_FOR_METHOD
See Also:
Constant Field Values

_clazz

private org.apache.bcel.classfile.JavaClass _clazz

_out

private java.io.PrintWriter _out

_cp

private org.apache.bcel.generic.ConstantPoolGen _cp
Constructor Detail

BCELifier

public BCELifier(org.apache.bcel.classfile.JavaClass clazz,
                 java.io.OutputStream out)
Method Detail

start

public void start()
Start Java code generation


visitJavaClass

public void visitJavaClass(org.apache.bcel.classfile.JavaClass clazz)

printCreate

private void printCreate()

printMain

private void printMain()

visitField

public void visitField(org.apache.bcel.classfile.Field field)

visitMethod

public void visitMethod(org.apache.bcel.classfile.Method method)

printFlags

static java.lang.String printFlags(int flags)

printFlags

static java.lang.String printFlags(int flags,
                                   int reason)

printArgumentTypes

static java.lang.String printArgumentTypes(org.apache.bcel.generic.Type[] arg_types)

printType

static java.lang.String printType(org.apache.bcel.generic.Type type)

printType

static java.lang.String printType(java.lang.String signature)

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Default main method