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

## Class BeforeStringInvoke

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

-     public class BeforeStringInvoke
      extends BeforeInvoke

  Like `BeforeInvoke`, this injection point searches for INVOKEVIRTUAL, INVOKESTATIC and INVOKESPECIAL opcodes matching its arguments and returns a list of insns immediately prior to matching instructions. This specialised version however only matches methods which accept a single string and return void, but allows the string itself to be matched as part of the search process. This is primarily used for matching particular invocations of Profiler::startSection with a specific argument. Note that because a string literal is required, this injection point can not be used to match invocations where the value being passed in is a variable.

  To be precise, this injection point matches invocations of the specified method which are preceded by an LDC instruction. The LDC instruction's payload can be specified with the ldc named argument (see below)

  The following parameters from `At` are accepted

  target
    A `Target Selector` which identifies the target method, the method must be specified with a signature which accepts a single string and returns void, eg. `(Ljava/lang/String;)V`
  ordinal
    The ordinal position of the method invocation to match. For example if the method is invoked 3 times and you want to match the 3rd then you can specify an ordinal of 2 (ordinals are zero-indexed). The default value is -1 which supresses ordinal matching
  named argument: ldc
    The value of the LDC node to look for prior to the method invocation

  Example:

  >        @At(value = "INVOKE_STRING",
  >           target="startSection(Ljava/lang/String;)V", args = { "ldc=root" })

  Notice the use of the named argument "ldc" which specifies the value of the target LDC node.

  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.points.BeforeInvoke

      `BeforeInvoke.SearchType`

    - ### 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.points.BeforeInvoke

      `allowPermissive, className, context, logger, mixin, ordinal, target`

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

      `DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BeforeStringInvoke​(InjectionPointData data)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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` | `inspectInsn​(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn)` |
    `protected boolean` | `matchesOrdinal​(int ordinal)` |

    - ### Methods inherited from class org.spongepowered.asm.mixin.injection.points.BeforeInvoke

      `addInsn, find, log, matchesInsn, setLogging`

    - ### 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

    - #### BeforeStringInvoke

          public BeforeStringInvoke​(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
      Overrides:
        `find` in class `BeforeInvoke`
      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

    - #### inspectInsn

          protected void inspectInsn​(java.lang.String desc,
                                     org.objectweb.asm.tree.InsnList insns,
                                     org.objectweb.asm.tree.AbstractInsnNode insn)

      Overrides:
        `inspectInsn` in class `BeforeInvoke`

    - #### matchesOrdinal

          protected boolean matchesOrdinal​(int ordinal)

      Overrides:
        `matchesOrdinal` in class `BeforeInvoke`