Package codechicken.mixin.api
Interface MixinCompiler
- All Known Implementing Classes:
MixinCompilerImpl
public interface MixinCompiler
Defines a compiler capable of generating a composite Class, comprised of
a Set of Scala-like Trait classes on top of a base Class implementation.
Created by covers1624 on 2/17/20.
-
Method Summary
Modifier and TypeMethodDescription<T> Class<T>compileMixinClass(String name, String superClass, Set<String> traits) Compiles a new class with the given name, super Class, and traits.static MixinCompilercreate()Create aMixinCompilerinstance.static MixinCompilercreate(MixinBackend backend) Create aMixinCompilerinstance, with the given MixinBackend.static MixinCompilercreate(MixinBackend backend, MixinDebugger debugger) static MixinCompilercreate(MixinBackend backend, MixinDebugger debugger, Collection<Class<? extends MixinLanguageSupport>> supports) Create aMixinCompilerinstance, with the givenMixinBackend,MixinDebuggerand the specified Collection ofMixinLanguageSupports.<T> Class<T>defineClass(String name, byte[] bytes) Defines a class.default @Nullable ClassInfogetClassInfo(@Nullable Class<?> clazz) Overload forgetClassInfo(String), taking aClassinstead.@Nullable ClassInfogetClassInfo(String name) Gets aClassInfoinstance for the given class name.@Nullable ClassInfogetClassInfo(org.objectweb.asm.tree.ClassNode node) Overload forgetClassInfo(String), taking aClassNodeinstead.@Nullable org.objectweb.asm.tree.ClassNodegetClassNode(String name) Loads aClassNodefor the given class name.<T> Class<T>getDefinedClass(String name) Get a previously defined class.<T extends MixinLanguageSupport>
TgetLanguageSupport(String name) Get aMixinLanguageSupportinstance with the given name.Gets theMixinBackendfor this MixinCompiler@Nullable MixinInfogetMixinInfo(String name) Gets aMixinInfofor the given Class name.registerTrait(org.objectweb.asm.tree.ClassNode cNode) Registers a Trait to theMixinCompiler.
-
Method Details
-
create
Create aMixinCompilerinstance.- Returns:
- The instance.
-
create
Create aMixinCompilerinstance, with the given MixinBackend.- Parameters:
backend- The MixinBackend.- Returns:
- The instance.
-
create
- Parameters:
backend- The MixinBackend.debugger- The MixinDebugger.- Returns:
- The instance.
-
create
static MixinCompiler create(MixinBackend backend, MixinDebugger debugger, Collection<Class<? extends MixinLanguageSupport>> supports) Create aMixinCompilerinstance, with the givenMixinBackend,MixinDebuggerand the specified Collection ofMixinLanguageSupports.- Parameters:
backend- The MixinBackend.debugger- The MixinDebugger.supports- The MixinLanguageSupport classes to load.- Returns:
- The instance.
-
getMixinBackend
MixinBackend getMixinBackend()Gets theMixinBackendfor this MixinCompiler- Returns:
- The MixinBackend instance.
-
getLanguageSupport
Get aMixinLanguageSupportinstance with the given name.- Parameters:
name- The name.- Returns:
- The
MixinLanguageSupportinstance ornull
-
getClassInfo
Gets aClassInfoinstance for the given class name.- Parameters:
name- The class name.- Returns:
- The ClassInfo
-
getClassInfo
Overload forgetClassInfo(String), taking aClassNodeinstead.- Parameters:
node- The ClassNode.- Returns:
- The ClassInfo.
-
getClassInfo
Overload forgetClassInfo(String), taking aClassinstead.- Parameters:
clazz- The Class.- Returns:
- The ClassInfo.
-
getClassNode
Loads aClassNodefor the given class name.- Parameters:
name- The Class name.- Returns:
- The ClassNode.
-
registerTrait
Registers a Trait to theMixinCompiler.- Parameters:
cNode- The ClassNode for the trait.- Returns:
- The MixinInfo for the trait.
-
getMixinInfo
Gets aMixinInfofor the given Class name.- Parameters:
name- The Class name- Returns:
- The MixinInfo, Null if it does not exist.
-
defineClass
Defines a class.- Parameters:
name- The name for the class.bytes- The bytes for the class.- Returns:
- The defined class.
-
getDefinedClass
Get a previously defined class.- Parameters:
name- The name of the previously defined class.- Returns:
- The defined class.
- Throws:
NullPointerException- If the class was not found.
-
compileMixinClass
Compiles a new class with the given name, super Class, and traits.- Parameters:
name- The name for the class.superClass- The name for the super class.straits- The Traits to mixin.- Returns:
- The compiled class.
-