public abstract class Injector
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Injector.TargetNode
A nominated target node
|
| Modifier and Type | Field and Description |
|---|---|
protected org.spongepowered.asm.lib.tree.ClassNode |
classNode
Class node
|
protected InjectionInfo |
info
Injection info
|
protected boolean |
isStatic
True if the callback method is static
|
protected static org.apache.logging.log4j.Logger |
logger
Log more things
|
protected org.spongepowered.asm.lib.Type[] |
methodArgs
Arguments of the handler method
|
protected org.spongepowered.asm.lib.tree.MethodNode |
methodNode
Callback method
|
protected org.spongepowered.asm.lib.Type |
returnType
Return type of the handler method
|
| Constructor and Description |
|---|
Injector(InjectionInfo info)
Make a new CallbackInjector for the supplied InjectionInfo
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTargetNode(Target target,
java.util.List<InjectionNodes.InjectionNode> myNodes,
org.spongepowered.asm.lib.tree.AbstractInsnNode node,
java.util.Set<InjectionPoint> nominators) |
static boolean |
canCoerce(char from,
char to)
Returns whether the from type can be coerced to the to
type.
|
static boolean |
canCoerce(java.lang.String from,
java.lang.String to)
Returns whether the from type can be coerced to the to
type.
|
static boolean |
canCoerce(org.spongepowered.asm.lib.Type from,
org.spongepowered.asm.lib.Type to)
Returns whether the from type can be coerced to the to
type.
|
java.util.List<InjectionNodes.InjectionNode> |
find(InjectorTarget injectorTarget,
java.util.List<InjectionPoint> injectionPoints)
...
|
protected boolean |
findTargetNodes(org.spongepowered.asm.lib.tree.MethodNode into,
InjectionPoint injectionPoint,
org.spongepowered.asm.lib.tree.InsnList insns,
java.util.Collection<org.spongepowered.asm.lib.tree.AbstractInsnNode> nodes) |
protected abstract void |
inject(Target target,
InjectionNodes.InjectionNode node) |
void |
inject(Target target,
java.util.List<InjectionNodes.InjectionNode> nodes)
Performs the injection on the specified target
|
protected org.spongepowered.asm.lib.tree.AbstractInsnNode |
invokeHandler(org.spongepowered.asm.lib.tree.InsnList insns)
Invoke the handler method
|
protected org.spongepowered.asm.lib.tree.AbstractInsnNode |
invokeHandler(org.spongepowered.asm.lib.tree.InsnList insns,
org.spongepowered.asm.lib.tree.MethodNode handler)
Invoke a handler method
|
protected void |
postInject(Target target,
InjectionNodes.InjectionNode node) |
protected void |
sanityCheck(Target target,
java.util.List<InjectionPoint> injectionPoints) |
protected void |
throwException(org.spongepowered.asm.lib.tree.InsnList insns,
java.lang.String exceptionType,
java.lang.String message)
Throw an exception.
|
java.lang.String |
toString() |
protected static final org.apache.logging.log4j.Logger logger
protected InjectionInfo info
protected final org.spongepowered.asm.lib.tree.ClassNode classNode
protected final org.spongepowered.asm.lib.tree.MethodNode methodNode
protected final org.spongepowered.asm.lib.Type[] methodArgs
protected final org.spongepowered.asm.lib.Type returnType
protected final boolean isStatic
public Injector(InjectionInfo info)
info - Information about this injectionpublic java.lang.String toString()
toString in class java.lang.Objectpublic final java.util.List<InjectionNodes.InjectionNode> find(InjectorTarget injectorTarget, java.util.List<InjectionPoint> injectionPoints)
injectorTarget - Target method to inject intoinjectionPoints - InjectionPoint instances which will identify
target insns in the target methodprotected void addTargetNode(Target target, java.util.List<InjectionNodes.InjectionNode> myNodes, org.spongepowered.asm.lib.tree.AbstractInsnNode node, java.util.Set<InjectionPoint> nominators)
public final void inject(Target target, java.util.List<InjectionNodes.InjectionNode> nodes)
target - target to inject intonodes - selected nodesprotected boolean findTargetNodes(org.spongepowered.asm.lib.tree.MethodNode into,
InjectionPoint injectionPoint,
org.spongepowered.asm.lib.tree.InsnList insns,
java.util.Collection<org.spongepowered.asm.lib.tree.AbstractInsnNode> nodes)
protected void sanityCheck(Target target, java.util.List<InjectionPoint> injectionPoints)
protected abstract void inject(Target target, InjectionNodes.InjectionNode node)
protected void postInject(Target target, InjectionNodes.InjectionNode node)
protected org.spongepowered.asm.lib.tree.AbstractInsnNode invokeHandler(org.spongepowered.asm.lib.tree.InsnList insns)
insns - Instruction list to inject intoprotected org.spongepowered.asm.lib.tree.AbstractInsnNode invokeHandler(org.spongepowered.asm.lib.tree.InsnList insns,
org.spongepowered.asm.lib.tree.MethodNode handler)
insns - Instruction list to inject intohandler - Actual method to invoke (may be different if using a
surrogate)protected void throwException(org.spongepowered.asm.lib.tree.InsnList insns,
java.lang.String exceptionType,
java.lang.String message)
insns - Insn list to inject intoexceptionType - Type of exception to throw (binary name)message - Message to pass to the exception constructorpublic static boolean canCoerce(org.spongepowered.asm.lib.Type from,
org.spongepowered.asm.lib.Type to)
from - type to coerce fromto - type to coerce topublic static boolean canCoerce(java.lang.String from,
java.lang.String to)
from - type to coerce fromto - type to coerce topublic static boolean canCoerce(char from,
char to)
from - type to coerce fromto - type to coerce to