Class SubClass

java.lang.Object
org.vesalainen.bcc.ClassFile
org.vesalainen.bcc.SubClass
All Implemented Interfaces:
AnnotatedConstruct, Element, Parameterizable, QualifiedNameable, TypeElement, Writable

public class SubClass extends ClassFile
  • Field Details

  • Constructor Details

  • Method Details

    • addAttribute

      public final void addAttribute(AttributeInfo ai)
      Description copied from class: ClassFile
      Adds a new attribute
      Overrides:
      addAttribute in class ClassFile
      Parameters:
      ai -
    • addConstantInfo

      protected int addConstantInfo(ConstantInfo ci, int fromIndex)
      Overrides:
      addConstantInfo in class ClassFile
    • addFieldInfo

      public void addFieldInfo(FieldInfo fieldInfo)
      Overrides:
      addFieldInfo in class ClassFile
    • addInterface

      public void addInterface(short intf)
      Overrides:
      addInterface in class ClassFile
    • addMethodInfo

      public void addMethodInfo(MethodInfo methodInfo)
      Overrides:
      addMethodInfo in class ClassFile
    • resolveFieldIndex

      int resolveFieldIndex(VariableElement field)
      Returns the constant map index to field. If entry doesn't exist it is created.
      Parameters:
      field -
      Returns:
    • resolveFieldIndex

      private int resolveFieldIndex(TypeElement declaringClass, String name, String descriptor)
      Returns the constant map index to field If entry doesn't exist it is created.
      Parameters:
      declaringClass -
      name -
      descriptor -
      Returns:
    • resolveMethodIndex

      int resolveMethodIndex(ExecutableElement method)
      Returns the constant map index to method If entry doesn't exist it is created.
      Parameters:
      method -
      Returns:
    • resolveInterfaceMethodIndex

      int resolveInterfaceMethodIndex(ExecutableElement method)
      Returns the constant map index to method If entry doesn't exist it is created.
      Parameters:
      method -
      Returns:
    • resolveNameIndex

      final int resolveNameIndex(CharSequence name)
      Returns the constant map index to name If entry doesn't exist it is created.
      Parameters:
      name -
      Returns:
    • resolveNameAndTypeIndex

      int resolveNameAndTypeIndex(String name, String descriptor)
      Returns the constant map index to name and type If entry doesn't exist it is created.
      Parameters:
      name -
      descriptor -
      Returns:
    • resolveClassIndex

      public final int resolveClassIndex(Class<?> type)
      Returns the constant map index to class If entry doesn't exist it is created.
      Parameters:
      type -
      Returns:
    • resolveClassIndex

      public final int resolveClassIndex(TypeElement type)
      Returns the constant map index to class If entry doesn't exist it is created.
      Parameters:
      type -
      Returns:
    • resolveClassIndex

      public final int resolveClassIndex(ArrayType arrayType)
      Returns the constant map index to class If entry doesn't exist it is created.
      Parameters:
      arrayType -
      Returns:
    • resolveConstantIndex

      public final int resolveConstantIndex(int constant)
      Returns the constant map index to constant If entry doesn't exist it is created.
      Parameters:
      constant -
      Returns:
    • resolveConstantIndex

      public final int resolveConstantIndex(float constant)
      Returns the constant map index to constant If entry doesn't exist it is created.
      Parameters:
      constant -
      Returns:
    • resolveConstantIndex

      public final int resolveConstantIndex(double constant)
      Returns the constant map index to constant If entry doesn't exist it is created.
      Parameters:
      constant -
      Returns:
    • resolveConstantIndex

      public final int resolveConstantIndex(long constant)
      Returns the constant map index to constant If entry doesn't exist it is created.
      Parameters:
      constant -
      Returns:
    • resolveConstantIndex

      public final int resolveConstantIndex(String constant)
      Returns the constant map index to constant If entry doesn't exist it is created.
      Parameters:
      constant -
      Returns:
    • codeDefaultConstructor

      public void codeDefaultConstructor(FieldInitializer... fis) throws IOException
      Throws:
      IOException
    • codeDefaultConstructor

      public void codeDefaultConstructor(FragmentCompiler fc, FieldInitializer... fis) throws IOException
      Throws:
      IOException
    • codeStaticInitializer

      public void codeStaticInitializer(FieldInitializer... fis) throws IOException
      Throws:
      IOException
    • defineField

      public void defineField(int modifier, String fieldName, Class<?> type)
      Define a new field.
      Parameters:
      modifier -
      fieldName -
      type -
    • defineField

      public void defineField(int modifier, String fieldName, TypeMirror type)
      Define a new field.
      Parameters:
      modifier -
      fieldName -
      type -
    • defineConstantField

      public void defineConstantField(int modifier, String fieldName, int constant)
      Define constant field and set the constant value.
      Parameters:
      modifier -
      fieldName -
      constant -
    • defineConstantField

      public void defineConstantField(int modifier, String fieldName, long constant)
      Define constant field and set the constant value.
      Parameters:
      modifier -
      fieldName -
      constant -
    • defineConstantField

      public void defineConstantField(int modifier, String fieldName, float constant)
      Define constant field and set the constant value.
      Parameters:
      modifier -
      fieldName -
      constant -
    • defineConstantField

      public void defineConstantField(int modifier, String fieldName, double constant)
      Define constant field and set the constant value.
      Parameters:
      modifier -
      fieldName -
      constant -
    • defineConstantField

      public void defineConstantField(int modifier, String fieldName, String constant)
      Define constant field and set the constant value.
      Parameters:
      modifier -
      fieldName -
      constant -
    • createStaticInitializer

      public void createStaticInitializer(MethodCompiler mc) throws IOException
      Throws:
      IOException
    • buildMethod

      public ExecutableElementImpl.MethodBuilder buildMethod(String methodName)
    • defineMethod

      public void defineMethod(MethodCompiler mc, int modifier, String methodName, Class<?> returnType, Class<?>... parameters) throws IOException
      Throws:
      IOException
    • defineMethod

      public void defineMethod(MethodCompiler mc, int modifier, String methodName, Class<?> returnType, Class<?>[] exceptionTypes, Class<?>... parameters) throws IOException
      Throws:
      IOException
    • overrideConstructor

      public void overrideConstructor(MethodCompiler mc, int modifier, Class<?>... parameters) throws IOException
      Throws:
      IOException
    • overrideMethod

      public void overrideMethod(MethodCompiler mc, int modifier, String methodName, Class<?>... parameters) throws IOException
      Throws:
      IOException
    • overrideMethod

      public void overrideMethod(MethodCompiler mc, ExecutableElement method, Modifier... modifiers) throws IOException
      Throws:
      IOException
    • overrideMethod

      public void overrideMethod(MethodCompiler mc, ExecutableElement method, Set<Modifier> modifiers) throws IOException
      Throws:
      IOException
    • defineMethod

      public void defineMethod(MethodCompiler mc, ExecutableElement method) throws IOException
      Throws:
      IOException
    • defineMethod

      private void defineMethod(MethodCompiler mc, SubClass.Method method) throws IOException
      Throws:
      IOException
    • newInstance

      public Object newInstance() throws IOException
      Throws:
      IOException
    • load

      public Class<?> load() throws IOException
      Throws:
      IOException
    • createSourceFile

      public void createSourceFile(ProcessingEnvironment env) throws IOException
      Throws:
      IOException
    • dump

      public void dump() throws IOException
      Throws:
      IOException
    • save

      public void save(ProcessingEnvironment env) throws IOException
      Saves subclass as class file
      Parameters:
      env -
      Throws:
      IOException
    • write

      public void write(DataOutput out) throws IOException
      Writes the class
      Specified by:
      write in interface Writable
      Overrides:
      write in class ClassFile
      Parameters:
      out -
      Throws:
      IOException
    • addSignatureIfNeed

      private void addSignatureIfNeed()
    • getVariableFor

      VariableElement getVariableFor(VariableElement ve)
    • hasTypeParameters

      private boolean hasTypeParameters(VariableElement ve)
    • hasTypeParameters

      private boolean hasTypeParameters(TypeMirror type)
    • getActualType

      private TypeMirror getActualType(TypeMirror type)
    • getActualTypeFor

      private TypeMirror getActualTypeFor(TypeParameterElement typeParameter)