Class ArgsClassGenerator

  • All Implemented Interfaces:
    IClassGenerator

    public final class ArgsClassGenerator
    extends java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean generate​(java.lang.String name, org.objectweb.asm.tree.ClassNode classNode)
      Generate (if possible) the specified class name.
      ISyntheticClassInfo getArgsClass​(java.lang.String desc, IMixinInfo mixin)
      Get (or generate) the class name for the specified descriptor.
      java.lang.String getName()
      Get the name of this generator for logging and auditing purposes
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ARGS_NAME

        public static final java.lang.String ARGS_NAME
      • ARGS_REF

        public static final java.lang.String ARGS_REF
      • SYNTHETIC_PACKAGE

        public static final java.lang.String SYNTHETIC_PACKAGE
        See Also:
        Constant Field Values
    • Constructor Detail

      • ArgsClassGenerator

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

      • getName

        public java.lang.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​(java.lang.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​(java.lang.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