Interface MixinFactory<B,F>

All Known Implementing Classes:
MixinFactoryImpl, SidedFactory

public interface MixinFactory<B,F>
Represents a 'user' facing interface for interacting and caching the MixinCompiler.

Created by covers1624 on 2/17/20.

  • Method Details

    • getMixinCompiler

      MixinCompiler getMixinCompiler()
      Gets the associated MixinCompiler for this MixinFactory.
      Returns:
      The MixinCompiler.
    • registerTrait

      MixinFactory.TraitKey registerTrait(Class<?> tClass)
      Registers a trait.
      Parameters:
      tClass - The trait class.
      Returns:
      a TraitKey for using this registered trait.
    • registerTrait

      MixinFactory.TraitKey registerTrait(org.objectweb.asm.tree.ClassNode cNode)
      Registers a binary trait. Used for traits which are generated at runtime.
      Parameters:
      cNode - The ClassNode for the trait.
      Returns:
      a TraitKey for using this registered trait.
    • construct

      F construct(com.google.common.collect.ImmutableSet<MixinFactory.TraitKey> traits)
      Returns a factory (MixinFactory) capable of constructing a new MixinFactory with the given set of traits applied.

      The MixinFactory will cache constructed classes with the given set of traits, subsequent calls with the same traits will not cause a new class to be generated.

      It should be noted that, ImmutableSet is explicitly used here, as their hashCode is statically computed, making it favourable for use as a key in a Map.

      Parameters:
      traits - The traits to apply.
      Returns:
      The Factory.
    • getTraitsForClass

      com.google.common.collect.ImmutableSet<MixinFactory.TraitKey> getTraitsForClass(Class<?> clazz)
      Gets the traits that were used in compiling the given class. If the given class was not compiled by this factory, simply returns null.
      Parameters:
      clazz - The Class to get the traits for.
      Returns:
      The classes traits, or null if it was not compiled by this factory.