Package org.apache.bcel.util
Class BCELifier
- java.lang.Object
-
- org.apache.bcel.classfile.EmptyVisitor
-
- org.apache.bcel.util.BCELifier
-
- All Implemented Interfaces:
Visitor
public class BCELifier extends 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BCELifier.FLAGS
Enum corresponding to flag source.
-
Constructor Summary
Constructors Constructor Description BCELifier(JavaClass clazz, OutputStream out)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(String[] argv)
Default main methodstatic String
printFlags(int flags, BCELifier.FLAGS location)
Return a string with the flag settingsvoid
start()
Start Java code generationvoid
visitField(Field field)
void
visitJavaClass(JavaClass clazz)
void
visitMethod(Method method)
-
Methods inherited from class org.apache.bcel.classfile.EmptyVisitor
visitAnnotation, visitAnnotationDefault, visitAnnotationEntry, visitBootstrapMethods, visitCode, visitCodeException, visitConstantClass, visitConstantDouble, visitConstantDynamic, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantInvokeDynamic, visitConstantLong, visitConstantMethodHandle, visitConstantMethodref, visitConstantMethodType, visitConstantModule, visitConstantNameAndType, visitConstantPackage, visitConstantPool, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitEnclosingMethod, visitExceptionTable, visitInnerClass, visitInnerClasses, visitLineNumber, visitLineNumberTable, visitLocalVariable, visitLocalVariableTable, visitLocalVariableTypeTable, visitMethodParameter, visitMethodParameters, visitModule, visitModuleExports, visitModuleMainClass, visitModuleOpens, visitModulePackages, visitModuleProvides, visitModuleRequires, visitNestHost, visitNestMembers, visitParameterAnnotation, visitParameterAnnotationEntry, visitSignature, visitSourceFile, visitStackMap, visitStackMapEntry, visitSynthetic, visitUnknown
-
-
-
-
Constructor Detail
-
BCELifier
public BCELifier(JavaClass clazz, OutputStream out)
- Parameters:
clazz
- Java class to "decompile"out
- where to output Java program
-
-
Method Detail
-
start
public void start()
Start Java code generation
-
visitJavaClass
public void visitJavaClass(JavaClass clazz)
- Specified by:
visitJavaClass
in interfaceVisitor
- Overrides:
visitJavaClass
in classEmptyVisitor
-
visitField
public void visitField(Field field)
- Specified by:
visitField
in interfaceVisitor
- Overrides:
visitField
in classEmptyVisitor
-
visitMethod
public void visitMethod(Method method)
- Specified by:
visitMethod
in interfaceVisitor
- Overrides:
visitMethod
in classEmptyVisitor
-
printFlags
public static String printFlags(int flags, BCELifier.FLAGS location)
Return a string with the flag settings- Parameters:
flags
- the flags field to interpretlocation
- the item type- Returns:
- the formatted string
- Since:
- 6.0 made public
-
-