Class InjectionPointData
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.struct.InjectionPointData
-
public class InjectionPointData extends java.lang.ObjectData read from anAtannotation and passed into an InjectionPoint ctor
-
-
Constructor Summary
Constructors Constructor Description InjectionPointData(IInjectionPointContext context, java.lang.String at, java.util.List<java.lang.String> args, java.lang.String target, java.lang.String slice, int ordinal, int opcode, java.lang.String id, int flags)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ITargetSelectorget(java.lang.String key)Get the supplied value from the named args as a target selector, throws an exception if the argument cannot be parsed as a target selectorbooleanget(java.lang.String key, boolean defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not setintget(java.lang.String key, int defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not setjava.lang.Stringget(java.lang.String key, java.lang.String defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not set<T extends java.lang.Enum<T>>
Tget(java.lang.String key, T defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not setjava.lang.StringgetAt()Get the at value on the injectorIInjectionPointContextgetContext()Get the injection point contextjava.lang.StringgetDescription()Get a description of this injector for use in error messagesjava.lang.StringgetId()Get the id specified on the injection point (or null if not specified)LocalVariableDiscriminatorgetLocalVariableDiscriminator()IMessageSinkgetMessageSink()Get the message sink for this injection pointorg.objectweb.asm.tree.MethodNodegetMethod()Get the annotated methodorg.objectweb.asm.TypegetMethodReturnType()Get the return type of the annotated methodIMixinContextgetMixin()Get the mixin contextintgetOpcode()Get the opcode specified on the injection pointintgetOpcode(int defaultOpcode)Get the opcode specified on the injection point or return the default if no opcode was specifiedintgetOpcode(int defaultOpcode, int... validOpcodes)Get the opcode specified on the injection point or return the default if no opcode was specified or if the specified opcode does not appear in the supplied list of valid opcodesint[]getOpcodeList(java.lang.String key, int[] defaultValue)Get a list of opcodes specified in the injection point arguments.intgetOrdinal()Get the ordinal specified on the injection pointorg.objectweb.asm.tree.AnnotationNodegetParent()Get the root annotation (eg.java.lang.StringgetSlice()Get the slice id specified on the injectorInjectionPoint.SpecifiergetSpecifier()Get the specifier value parsed from the injectorITargetSelectorgetTarget()Get the target value specified on the injectorInjectionPoint.RestrictTargetLevelgetTargetRestriction()Get the target restriction specified in the annotationjava.lang.StringgetType()Get the parsed constructor type for this injectorbooleanisUnsafe()Get whether the unsafe option is set on the injection pointstatic java.lang.StringparseType(java.lang.String at)Parse a constructor type from the supplied at stringjava.lang.StringtoString()
-
-
-
Constructor Detail
-
InjectionPointData
public InjectionPointData(IInjectionPointContext context, java.lang.String at, java.util.List<java.lang.String> args, java.lang.String target, java.lang.String slice, int ordinal, int opcode, java.lang.String id, int flags)
-
-
Method Detail
-
getMessageSink
public IMessageSink getMessageSink()
Get the message sink for this injection point
-
getAt
public java.lang.String getAt()
Get the at value on the injector
-
getType
public java.lang.String getType()
Get the parsed constructor type for this injector
-
getSpecifier
public InjectionPoint.Specifier getSpecifier()
Get the specifier value parsed from the injector
-
getTargetRestriction
public InjectionPoint.RestrictTargetLevel getTargetRestriction()
Get the target restriction specified in the annotation
-
getContext
public IInjectionPointContext getContext()
Get the injection point context
-
getMixin
public IMixinContext getMixin()
Get the mixin context
-
getMethod
public org.objectweb.asm.tree.MethodNode getMethod()
Get the annotated method
-
getMethodReturnType
public org.objectweb.asm.Type getMethodReturnType()
Get the return type of the annotated method
-
getParent
public org.objectweb.asm.tree.AnnotationNode getParent()
Get the root annotation (eg.Inject)
-
getSlice
public java.lang.String getSlice()
Get the slice id specified on the injector
-
getLocalVariableDiscriminator
public LocalVariableDiscriminator getLocalVariableDiscriminator()
-
get
public java.lang.String get(java.lang.String key, java.lang.String defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not set- Parameters:
key- argument namedefaultValue- value to return if the arg is not set- Returns:
- argument value or default if not set
-
get
public int get(java.lang.String key, int defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not set- Parameters:
key- argument namedefaultValue- value to return if the arg is not set- Returns:
- argument value or default if not set
-
get
public boolean get(java.lang.String key, boolean defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not set- Parameters:
key- argument namedefaultValue- value to return if the arg is not set- Returns:
- argument value or default if not set
-
get
public <T extends java.lang.Enum<T>> T get(java.lang.String key, T defaultValue)Get the supplied value from the named args, return defaultValue if the arg is not set- Type Parameters:
T- enum type- Parameters:
key- argument namedefaultValue- value to return if the arg is not set- Returns:
- argument value or default if not set
-
get
public ITargetSelector get(java.lang.String key)
Get the supplied value from the named args as a target selector, throws an exception if the argument cannot be parsed as a target selector- Parameters:
key- argument name- Returns:
- argument value as a target selector
-
getTarget
public ITargetSelector getTarget()
Get the target value specified on the injector
-
getDescription
public java.lang.String getDescription()
Get a description of this injector for use in error messages
-
getOrdinal
public int getOrdinal()
Get the ordinal specified on the injection point
-
getOpcode
public int getOpcode()
Get the opcode specified on the injection point
-
getOpcode
public int getOpcode(int defaultOpcode)
Get the opcode specified on the injection point or return the default if no opcode was specified- Parameters:
defaultOpcode- opcode to return if none specified- Returns:
- opcode or default
-
getOpcode
public int getOpcode(int defaultOpcode, int... validOpcodes)Get the opcode specified on the injection point or return the default if no opcode was specified or if the specified opcode does not appear in the supplied list of valid opcodes- Parameters:
defaultOpcode- opcode to return if none specifiedvalidOpcodes- valid opcodes- Returns:
- opcode or default
-
getOpcodeList
public int[] getOpcodeList(java.lang.String key, int[] defaultValue)Get a list of opcodes specified in the injection point arguments. The opcodes can be specified as raw integer values or as their corresponding constant name from theOpcodesinterface. All the values should be separated by spaces or commas. The returned array is sorted in order to make it suitable for use with theArrays#binarySearchmethod.- Parameters:
key- argument namedefaultValue- value to return if the key is not specified- Returns:
- parsed opcodes as array or default value if the key is not specified in the args
-
getId
public java.lang.String getId()
Get the id specified on the injection point (or null if not specified)
-
isUnsafe
public boolean isUnsafe()
Get whether the unsafe option is set on the injection point
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
parseType
public static java.lang.String parseType(java.lang.String at)
Parse a constructor type from the supplied at string- Parameters:
at- at to parse- Returns:
- parsed constructor type
-
-