Package org.apache.bcel.util
Class BCELifier
java.lang.Object
org.apache.bcel.classfile.EmptyVisitor
org.apache.bcel.util.BCELifier
- All Implemented Interfaces:
Visitor
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
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) void
visitStackMap
(StackMap stackMap) void
visitStackMapEntry
(StackMapEntry stackMapEntry) void
visitStackMapType
(StackMapType stackMapType) Visits aStackMapType
object.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, visitSynthetic, visitUnknown
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.bcel.classfile.Visitor
visitRecord, visitRecordComponent
-
Constructor Details
-
BCELifier
Constructs a new instance.- Parameters:
clazz
- Java class to "decompile".out
- where to print the Java program in UTF-8.
-
-
Method Details
-
main
Default main method- Throws:
Exception
-
printFlags
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
-
start
Start Java code generation -
visitField
- Specified by:
visitField
in interfaceVisitor
- Overrides:
visitField
in classEmptyVisitor
-
visitJavaClass
- Specified by:
visitJavaClass
in interfaceVisitor
- Overrides:
visitJavaClass
in classEmptyVisitor
-
visitMethod
- Specified by:
visitMethod
in interfaceVisitor
- Overrides:
visitMethod
in classEmptyVisitor
-
visitStackMap
- Specified by:
visitStackMap
in interfaceVisitor
- Overrides:
visitStackMap
in classEmptyVisitor
-
visitStackMapEntry
- Specified by:
visitStackMapEntry
in interfaceVisitor
- Overrides:
visitStackMapEntry
in classEmptyVisitor
-
visitStackMapType
Visits aStackMapType
object.- Specified by:
visitStackMapType
in interfaceVisitor
- Overrides:
visitStackMapType
in classEmptyVisitor
- Parameters:
stackMapType
- object to visit- Since:
- 6.7.1
-