Class LocalVariableDiscriminator
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.modify.LocalVariableDiscriminator
-
public class LocalVariableDiscriminator extends java.lang.ObjectEncapsulates logic for identifying a local variable in a target method using 3 criteria: ordinal, index and name. This is used by theModifyVariableInjectorand its associated injection points.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLocalVariableDiscriminator.ContextDiscriminator context information, wraps all relevant information about a target location for use when performing discrimination
-
Constructor Summary
Constructors Constructor Description LocalVariableDiscriminator(boolean argsOnly, int ordinal, int index, java.util.Set<java.lang.String> names, boolean print)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindLocal(LocalVariableDiscriminator.Context context)Find a local variable for the specified contextintgetIndex()Get the local variable absolute indexjava.util.Set<java.lang.String>getNames()Get valid names for considerationintgetOrdinal()Get the local variable ordinal (nth variable of type)booleanhasNames()Returns true if names is not emptybooleanisArgsOnly()True if this discriminator will examine only the target method args and won't consider the rest of the LVT at the target locationprotected booleanisImplicit(LocalVariableDiscriminator.Context context)If the user specifies no values for ordinal, index or names then we are considered to be operating in "implicit mode" where only a single local variable of the specified type is expected to exist.static LocalVariableDiscriminatorparse(org.objectweb.asm.tree.AnnotationNode annotation)Parse a local variable discriminator from the supplied annotationbooleanprintLVT()True if the injector should print the LVTjava.lang.StringtoString()java.lang.StringtoString(LocalVariableDiscriminator.Context context)
-
-
-
Constructor Detail
-
LocalVariableDiscriminator
public LocalVariableDiscriminator(boolean argsOnly, int ordinal, int index, java.util.Set<java.lang.String> names, boolean print)- Parameters:
argsOnly- true to only search within the method argumentsordinal- target variable ordinalindex- target variable indexnames- target variable namesprint- true to print lvt
-
-
Method Detail
-
isArgsOnly
public boolean isArgsOnly()
True if this discriminator will examine only the target method args and won't consider the rest of the LVT at the target location
-
getOrdinal
public int getOrdinal()
Get the local variable ordinal (nth variable of type)
-
getIndex
public int getIndex()
Get the local variable absolute index
-
getNames
public java.util.Set<java.lang.String> getNames()
Get valid names for consideration
-
hasNames
public boolean hasNames()
Returns true if names is not empty
-
printLVT
public boolean printLVT()
True if the injector should print the LVT
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(LocalVariableDiscriminator.Context context)
-
isImplicit
protected boolean isImplicit(LocalVariableDiscriminator.Context context)
If the user specifies no values for ordinal, index or names then we are considered to be operating in "implicit mode" where only a single local variable of the specified type is expected to exist.- Parameters:
context- Target context- Returns:
- true if operating in implicit mode
-
findLocal
public int findLocal(LocalVariableDiscriminator.Context context)
Find a local variable for the specified context- Parameters:
context- search context- Returns:
- index of local or -1 if not found
-
parse
public static LocalVariableDiscriminator parse(org.objectweb.asm.tree.AnnotationNode annotation)
Parse a local variable discriminator from the supplied annotation- Parameters:
annotation- annotation to parse- Returns:
- discriminator configured using values from the annoation
-
-