Package org.spongepowered.asm.mixin.injection.points

## Class BeforeConstant

- java.lang.Object
- - org.spongepowered.asm.mixin.injection.InjectionPoint
  - - org.spongepowered.asm.mixin.injection.points.BeforeConstant

    public class BeforeConstant
    extends InjectionPoint

Special injection point which can be defined by an `Constant` annotation or using the at code `CONSTANT`.

This injection point searches for `LDC` and other constant opcodes matching its arguments and returns a list of injection points matching those instructions. When used with `At` it accepts the following parameters:

ordinal
  The ordinal position of the constant opcode to match. The default value is -1 which supresses ordinal matching
named argument: nullValue
  To match `null` literals in the method body, set this to `true`
named argument: intValue
  To match `int` literals in the method body. See also the expandZeroConditions argument below for concerns when matching conditional zeroes.
named argument: floatValue
  To match `float` literals in the method body.
named argument: longValue
  To match `long` literals in the method body.
named argument: doubleValue
  To match `double` literals in the method body.
named argument: stringValue
  To match `String` literals in the method body.
named argument: classValue
  To match `Class` literals in the method body.
named argument: log
  Enable debug logging when searching for matching opcodes.
named argument: expandZeroConditions
  See the `Constant.expandZeroConditions()` option, this argument should be a list of `Constant.Condition` names

Examples:

>        // Find all integer constans with value 4
>        @At(value = "CONSTANT", args = "intValue=4")

>        // Find the String literal "foo"
>        @At(value = "CONSTANT", args = "stringValue=foo"

>        // Find integer constants with value 0 and expand conditionals
>        @At(
>          value = "CONSTANT",
>          args = {
>            "intValue=0",
>            "expandZeroConditions=LESS_THAN_ZERO,GREATER_THAN_ZERO"
>          }
>        )

Note that like all standard injection points, this class matches the insn itself, putting the injection point immediately before the access in question. Use `shift` specifier to adjust the matched opcode as necessary.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint

`InjectionPoint.AtCode, InjectionPoint.Flags, InjectionPoint.RestrictTargetLevel, InjectionPoint.Specifier`

### Field Summary

### Fields inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint

`DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY`

### Constructor Summary

Constructors
`BeforeConstant​(InjectionPointData data)`
`BeforeConstant​(IMixinContext context, org.objectweb.asm.tree.AnnotationNode node, java.lang.String returnType)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `find​(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)` Find injection points in the supplied insn list
`protected void` `log​(java.lang.String message, java.lang.Object... params)`

### Methods inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint

`addMessage, after, and, before, checkPriority, getAtCode, getId, getSlice, getSpecifier, getTargetRestriction, nextNode, or, parse, parse, parse, parse, parse, parse, parse, parse, register, register, setTargetRestriction, shift, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### BeforeConstant

    public BeforeConstant​(IMixinContext context,
                          org.objectweb.asm.tree.AnnotationNode node,
                          java.lang.String returnType)

#### BeforeConstant

    public BeforeConstant​(InjectionPointData data)

### Method Detail

#### find

    public boolean find​(java.lang.String desc,
                        org.objectweb.asm.tree.InsnList insns,
                        java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)

Description copied from class: `InjectionPoint`
Find injection points in the supplied insn list

Specified by:
  `find` in class `InjectionPoint`
Parameters:
  `desc` - Method descriptor, supplied to allow return types and arguments etc. to be determined
  `insns` - Insn list to search in, the strategy MUST ONLY add nodes from this list to the `nodes` collection
  `nodes` - Collection of nodes to populate. Injectors should NOT make any assumptions about the state of this collection and should only call the add() method
Returns:
  true if one or more injection points were found

#### log

    protected void log​(java.lang.String message,
                       java.lang.Object... params)