public abstract class InjectionInfo extends SpecialMethodInfo implements ISliceContext
Inject annotation
and allows the injection to be processed.| Modifier and Type | Class and Description |
|---|---|
static interface |
InjectionInfo.AnnotationType
Decoration for subclasses which indicates the injector annotation that
the subclass handles
|
static interface |
InjectionInfo.HandlerPrefix
Decoration for subclasses which specifies the prefix to use when
conforming annotated handler methods
|
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
atKey
The key into the annotation which contains the injection points
|
static java.lang.String |
DEFAULT_PREFIX
Default conform prefix for handler methods
|
protected InjectorGroupInfo |
group
Injection group
|
protected java.util.List<InjectionPoint> |
injectionPoints
Injection points parsed from
At annotations |
protected Injector |
injector
Bytecode injector
|
protected boolean |
isStatic
Annotated method is static
|
protected MethodSlices |
slices
Method slice descriptors parsed from the annotation
|
protected int |
targetCount
Number of target methods identified by the injection points
|
protected java.util.Map<Target,java.util.List<InjectionNodes.InjectionNode>> |
targetNodes
Map of lists of nodes enumerated by calling
prepare() |
protected java.util.Deque<org.objectweb.asm.tree.MethodNode> |
targets
Target method(s)
|
annotation, annotationType, classNode, method, methodName, mixin| Modifier | Constructor and Description |
|---|---|
protected |
InjectionInfo(MixinTargetContext mixin,
org.objectweb.asm.tree.MethodNode method,
org.objectweb.asm.tree.AnnotationNode annotation)
ctor
|
protected |
InjectionInfo(MixinTargetContext mixin,
org.objectweb.asm.tree.MethodNode method,
org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.String atKey) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCallbackInvocation(org.objectweb.asm.tree.MethodNode handler)
Notify method, called by injector when adding a callback into a target
|
org.objectweb.asm.tree.MethodNode |
addMethod(int access,
java.lang.String name,
java.lang.String desc)
Inject a method into the target class
|
protected java.lang.String |
getDescription() |
protected java.lang.String |
getDynamicInfo()
Get info from a decorating
Dynamic annotation. |
int |
getInjectedCallbackCount()
Get the injected callback count
|
static org.objectweb.asm.tree.AnnotationNode |
getInjectorAnnotation(IMixinInfo mixin,
org.objectweb.asm.tree.MethodNode method)
Returns any injector annotation found on the specified method.
|
static java.lang.String |
getInjectorPrefix(org.objectweb.asm.tree.AnnotationNode annotation)
Get the conform prefix for an injector handler by type
|
MethodSlice |
getSlice(java.lang.String id)
Get the slice descriptors
|
java.lang.String |
getSliceId(java.lang.String id)
Return the mapped slice id for the specified ID.
|
java.util.Collection<org.objectweb.asm.tree.MethodNode> |
getTargets()
Get methods being injected into
|
void |
inject()
Perform injections
|
boolean |
isValid()
Get whether there is enough valid information in this info to actually
perform an injection.
|
void |
notifyInjected(Target target)
Callback from injector which notifies us that a callback was injected.
|
static InjectionInfo |
parse(MixinTargetContext mixin,
org.objectweb.asm.tree.MethodNode method)
Parse an injector from the specified method (if an injector annotation is
present).
|
protected void |
parseInjectionPoints(java.util.List<org.objectweb.asm.tree.AnnotationNode> ats) |
protected abstract Injector |
parseInjector(org.objectweb.asm.tree.AnnotationNode injectAnnotation) |
protected void |
parseRequirements() |
protected java.util.Set<ITargetSelector> |
parseTargets() |
void |
postInject()
Perform cleanup and post-injection tasks
|
void |
prepare()
Discover injection points
|
protected void |
readAnnotation()
Parse the info from the supplied annotation
|
protected java.util.List<org.objectweb.asm.tree.AnnotationNode> |
readInjectionPoints() |
static void |
register(java.lang.Class<? extends InjectionInfo> type)
Register an injector info class.
|
java.lang.String |
toString() |
getAnnotation, getClassNode, getContext, getMethod, getMethodNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAnnotation, getContext, getMethodpublic static final java.lang.String DEFAULT_PREFIX
protected final boolean isStatic
protected final java.util.Deque<org.objectweb.asm.tree.MethodNode> targets
protected final MethodSlices slices
protected final java.lang.String atKey
protected final java.util.List<InjectionPoint> injectionPoints
At annotationsprotected final java.util.Map<Target,java.util.List<InjectionNodes.InjectionNode>> targetNodes
prepare()protected int targetCount
protected Injector injector
protected InjectorGroupInfo group
protected InjectionInfo(MixinTargetContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode annotation)
mixin - Mixin datamethod - Injector methodannotation - Annotation to parseprotected InjectionInfo(MixinTargetContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode annotation, java.lang.String atKey)
protected void readAnnotation()
protected java.util.Set<ITargetSelector> parseTargets()
protected java.util.List<org.objectweb.asm.tree.AnnotationNode> readInjectionPoints()
protected void parseInjectionPoints(java.util.List<org.objectweb.asm.tree.AnnotationNode> ats)
protected void parseRequirements()
protected abstract Injector parseInjector(org.objectweb.asm.tree.AnnotationNode injectAnnotation)
public boolean isValid()
public void prepare()
public void inject()
public void postInject()
public void notifyInjected(Target target)
target - target into which the injector injectedprotected java.lang.String getDescription()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Collection<org.objectweb.asm.tree.MethodNode> getTargets()
public MethodSlice getSlice(java.lang.String id)
getSlice in interface ISliceContextid - slice id to fetchpublic java.lang.String getSliceId(java.lang.String id)
id - slice idpublic int getInjectedCallbackCount()
public org.objectweb.asm.tree.MethodNode addMethod(int access,
java.lang.String name,
java.lang.String desc)
access - Method access flags, synthetic will be automatically addedname - Method namedesc - Method descriptorpublic void addCallbackInvocation(org.objectweb.asm.tree.MethodNode handler)
handler - callback handler being invokedprotected java.lang.String getDynamicInfo()
Dynamic annotation. If the annotation
is present, a descriptive string suitable for inclusion in an error
message is returned. If the annotation is not present then an empty
string is returned.public static InjectionInfo parse(MixinTargetContext mixin, org.objectweb.asm.tree.MethodNode method)
mixin - contextmethod - mixin methodpublic static org.objectweb.asm.tree.AnnotationNode getInjectorAnnotation(IMixinInfo mixin, org.objectweb.asm.tree.MethodNode method)
mixin - contextmethod - mixin methodpublic static java.lang.String getInjectorPrefix(org.objectweb.asm.tree.AnnotationNode annotation)
annotation - Annotation to inspectpublic static void register(java.lang.Class<? extends InjectionInfo> type)
InjectionInfo.AnnotationType annotation for registration purposes.type - injection info subclass to register