Record Class CodeRelabelerImpl

java.lang.Object
java.lang.Record
org.glavo.classfile.impl.CodeRelabelerImpl
All Implemented Interfaces:
ClassFileTransform<CodeTransform,CodeElement,CodeBuilder>, CodeTransform, CodeRelabeler

public record CodeRelabelerImpl(BiFunction<Label,CodeBuilder,Label> mapFunction) extends Record implements CodeRelabeler
  • Constructor Details

    • CodeRelabelerImpl

      public CodeRelabelerImpl(BiFunction<Label,CodeBuilder,Label> mapFunction)
      Creates an instance of a CodeRelabelerImpl record class.
      Parameters:
      mapFunction - the value for the mapFunction record component
  • Method Details

    • relabel

      public Label relabel(Label label, CodeBuilder cob)
      Description copied from interface: CodeRelabeler
      Access method to internal re-labeling function.
      Specified by:
      relabel in interface CodeRelabeler
      Parameters:
      label - source label
      cob - builder to create new labels
      Returns:
      target label
    • accept

      public void accept(CodeBuilder cob, CodeElement coe)
      Description copied from interface: ClassFileTransform
      Transform an element by taking the appropriate actions on the builder. Used when transforming a classfile entity (class, method, field, method body.) If no transformation is desired, the element can be presented to ClassFileBuilder.with(ClassFileElement). If the element is to be dropped, no action is required.
      Specified by:
      accept in interface ClassFileTransform<CodeTransform,CodeElement,CodeBuilder>
      Parameters:
      cob - the builder for the new entity
      coe - the element
    • 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.
    • mapFunction

      public BiFunction<Label,CodeBuilder,Label> mapFunction()
      Returns the value of the mapFunction record component.
      Returns:
      the value of the mapFunction record component