Record Class ClassFileImpl

java.lang.Object
java.lang.Record
org.glavo.classfile.impl.ClassFileImpl
All Implemented Interfaces:
ClassFile

public record ClassFileImpl(ClassFile.StackMapsOption stackMapsOption, ClassFile.DebugElementsOption debugElementsOption, ClassFile.LineNumbersOption lineNumbersOption, ClassFile.AttributesProcessingOption attributesProcessingOption, ClassFile.ConstantPoolSharingOption constantPoolSharingOption, ClassFile.ShortJumpsOption shortJumpsOption, ClassFile.DeadCodeOption deadCodeOption, ClassFile.DeadLabelsOption deadLabelsOption, ClassFile.ClassHierarchyResolverOption classHierarchyResolverOption, ClassFile.AttributeMapperOption attributeMapperOption) extends Record implements ClassFile
  • Field Details

    • DEFAULT_CONTEXT

      public static final ClassFileImpl DEFAULT_CONTEXT
  • Constructor Details

  • Method Details

    • withOptions

      public ClassFileImpl withOptions(ClassFile.Option... options)
      Description copied from interface: ClassFile
      Returns a copy of the context with altered options.
      Specified by:
      withOptions in interface ClassFile
      Parameters:
      options - the desired processing options
      Returns:
      a copy of the context with altered options
    • parse

      public ClassModel parse(byte[] bytes)
      Description copied from interface: ClassFile
      Parse a classfile into a ClassModel.
      Specified by:
      parse in interface ClassFile
      Parameters:
      bytes - the bytes of the classfile
      Returns:
      the class model
    • build

      public byte[] build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)
      Description copied from interface: ClassFile
      Build a classfile into a byte array using the provided constant pool builder.
      Specified by:
      build in interface ClassFile
      Parameters:
      thisClassEntry - the name of the class to build
      constantPool - the constant pool builder
      handler - a handler that receives a ClassBuilder
      Returns:
      the classfile bytes
    • transform

      public byte[] transform(ClassModel model, ClassEntry newClassName, ClassTransform transform)
      Description copied from interface: ClassFile
      Transform one classfile into a new classfile with the aid of a ClassTransform. The transform will receive each element of this class, as well as a ClassBuilder for building the new class. The transform is free to preserve, remove, or replace elements as it sees fit.
      Specified by:
      transform in interface ClassFile
      Parameters:
      model - the class model to transform
      newClassName - new class name
      transform - the transform
      Returns:
      the bytes of the new class
    • verify

      public List<VerifyError> verify(ClassModel model)
      Description copied from interface: ClassFile
      Verify a classfile. Any verification errors found will be returned.
      Specified by:
      verify in interface ClassFile
      Parameters:
      model - the class model to verify
      Returns:
      a list of verification errors, or an empty list if no errors are found
    • verify

      public List<VerifyError> verify(byte[] bytes)
      Description copied from interface: ClassFile
      Verify a classfile. Any verification errors found will be returned.
      Specified by:
      verify in interface ClassFile
      Parameters:
      bytes - the classfile bytes to verify
      Returns:
      a list of verification errors, or an empty list if no errors are found
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • stackMapsOption

      public ClassFile.StackMapsOption stackMapsOption()
      Returns the value of the stackMapsOption record component.
      Returns:
      the value of the stackMapsOption record component
    • debugElementsOption

      public ClassFile.DebugElementsOption debugElementsOption()
      Returns the value of the debugElementsOption record component.
      Returns:
      the value of the debugElementsOption record component
    • lineNumbersOption

      public ClassFile.LineNumbersOption lineNumbersOption()
      Returns the value of the lineNumbersOption record component.
      Returns:
      the value of the lineNumbersOption record component
    • attributesProcessingOption

      public ClassFile.AttributesProcessingOption attributesProcessingOption()
      Returns the value of the attributesProcessingOption record component.
      Returns:
      the value of the attributesProcessingOption record component
    • constantPoolSharingOption

      public ClassFile.ConstantPoolSharingOption constantPoolSharingOption()
      Returns the value of the constantPoolSharingOption record component.
      Returns:
      the value of the constantPoolSharingOption record component
    • shortJumpsOption

      public ClassFile.ShortJumpsOption shortJumpsOption()
      Returns the value of the shortJumpsOption record component.
      Returns:
      the value of the shortJumpsOption record component
    • deadCodeOption

      public ClassFile.DeadCodeOption deadCodeOption()
      Returns the value of the deadCodeOption record component.
      Returns:
      the value of the deadCodeOption record component
    • deadLabelsOption

      public ClassFile.DeadLabelsOption deadLabelsOption()
      Returns the value of the deadLabelsOption record component.
      Returns:
      the value of the deadLabelsOption record component
    • classHierarchyResolverOption

      public ClassFile.ClassHierarchyResolverOption classHierarchyResolverOption()
      Returns the value of the classHierarchyResolverOption record component.
      Returns:
      the value of the classHierarchyResolverOption record component
    • attributeMapperOption

      public ClassFile.AttributeMapperOption attributeMapperOption()
      Returns the value of the attributeMapperOption record component.
      Returns:
      the value of the attributeMapperOption record component