Class ArgsClassGenerator

java.lang.Object
org.spongepowered.asm.mixin.injection.invoke.arg.ArgsClassGenerator
All Implemented Interfaces:
IClassGenerator

public final class ArgsClassGenerator extends Object implements IClassGenerator
Class generator which creates subclasses of Args to be used by the ModifyArgs injector. The subclasses contain getter and setter logic to provide access to a particular configuration of arguments and classes are only generated for each unique argument combination.
  • Field Details

  • Constructor Details

    • ArgsClassGenerator

      public ArgsClassGenerator(IConsumer<ISyntheticClassInfo> registry)
      Ctor
      Parameters:
      registry - sythetic class registry
  • Method Details

    • getName

      public String getName()
      Description copied from interface: IClassGenerator
      Get the name of this generator for logging and auditing purposes
      Specified by:
      getName in interface IClassGenerator
    • getArgsClass

      public ISyntheticClassInfo getArgsClass(String desc, IMixinInfo mixin)
      Get (or generate) the class name for the specified descriptor. The class will not be generated until it is used. Calling this method simply allocates a name for the specified descriptor.
      Parameters:
      desc - Descriptor of the target method, the return type is ignored for the purposes of generating Args subclasses
      mixin - Mixin which requires the class. Only the first mixin to request a class will be registered against it but this is for debugging only anyway
      Returns:
      name of the Args subclass to use
    • generate

      public boolean generate(String name, org.objectweb.asm.tree.ClassNode classNode)
      Description copied from interface: IClassGenerator
      Generate (if possible) the specified class name. The generator should return null if it cannot generate the specified class, in order that the next generator in the chain can process the request. The first generator to return a value will halt further processing of the request.
      Specified by:
      generate in interface IClassGenerator
      Parameters:
      name - Class name to generate
      classNode - Empty ClassNode to populate
      Returns:
      True if the class was generated