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 enum`
  `BCELifier.FLAGS`
  Enum corresponding to flag source.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BCELifier(JavaClass clazz, OutputStream out)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `main(String[] argv)`
  Default main method
  `static String`
  `printFlags(int flags, BCELifier.FLAGS location)`
  Return a string with the flag settings
  `void`
  `start()`
  Start Java code generation
  `void`
  `visitField(Field field)`
  `void`
  `visitJavaClass(JavaClass clazz)`
  `void`
  `visitMethod(Method method)`
  `void`
  `visitStackMap(StackMap stackMap)`
  `void`
  `visitStackMapEntry(StackMapEntry stackMapEntry)`
  `void`
  `visitStackMapType(StackMapType stackMapType)`
  Visits a `StackMapType` 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`

- ## Constructor Details

  - ### BCELifier

    public BCELifier(JavaClass clazz, OutputStream out)
    Constructs a new instance.
    Parameters:
      `clazz` - Java class to "decompile".
      `out` - where to print the Java program in UTF-8.

- ## Method Details

  - ### main

    public static void main(String[] argv) throws Exception
    Default main method
    Throws:
      `Exception`

  - ### printFlags

    public static String printFlags(int flags, BCELifier.FLAGS location)
    Return a string with the flag settings
    Parameters:
      `flags` - the flags field to interpret
      `location` - the item type
    Returns:
      the formatted string
    Since:
      6.0 made public

  - ### start

    public void start()
    Start Java code generation

  - ### visitField

    public void visitField(Field field)
    Specified by:
      `visitField` in interface `Visitor`
    Overrides:
      `visitField` in class `EmptyVisitor`

  - ### visitJavaClass

    public void visitJavaClass(JavaClass clazz)
    Specified by:
      `visitJavaClass` in interface `Visitor`
    Overrides:
      `visitJavaClass` in class `EmptyVisitor`

  - ### visitMethod

    public void visitMethod(Method method)
    Specified by:
      `visitMethod` in interface `Visitor`
    Overrides:
      `visitMethod` in class `EmptyVisitor`

  - ### visitStackMap

    public void visitStackMap(StackMap stackMap)
    Specified by:
      `visitStackMap` in interface `Visitor`
    Overrides:
      `visitStackMap` in class `EmptyVisitor`

  - ### visitStackMapEntry

    public void visitStackMapEntry(StackMapEntry stackMapEntry)
    Specified by:
      `visitStackMapEntry` in interface `Visitor`
    Overrides:
      `visitStackMapEntry` in class `EmptyVisitor`

  - ### visitStackMapType

    public void visitStackMapType(StackMapType stackMapType)
    Visits a `StackMapType` object.
    Specified by:
      `visitStackMapType` in interface `Visitor`
    Overrides:
      `visitStackMapType` in class `EmptyVisitor`
    Parameters:
      `stackMapType` - object to visit
    Since:
      6.7.1