Package ftbsc.lll.utils
Class PatternMatcher.Builder
java.lang.Object
ftbsc.lll.utils.PatternMatcher.Builder
- Enclosing class:
- PatternMatcher
The Builder object for
PatternMatcher.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionany()Wildcard, matches any kind of node.build()Builds the pattern defined so far.Adds a custom predicate to the list.field()Matches a field invocation of any kind: one of GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.Tells the pattern matcher to ignore FRAME nodes.Tells the pattern matcher to ignore LABEL nodes.Tells the pattern matcher to ignore LINENUMBER nodes.Tells the pattern matcher to ignore all no-ops.jump()Matches any kind of jump instruction.label()Matches any kind of label.method()Matches a method invocation of any kind: one of INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.Matches the given opcode and the exact given arguments.opcode(int opcode) Matches a specific opcode.opcodes(int... opcodes) Matches a list of opcodes.reverse()Sets the pattern to match starting from the end.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Builds the pattern defined so far.- Returns:
- the built
PatternMatcher
-
reverse
Sets the pattern to match starting from the end.- Returns:
- the builder's state after the operation
-
check
Adds a custom predicate to the list. Also used internally.- Parameters:
predicate- the predicate to add- Returns:
- the builder's state after the operation
-
any
Wildcard, matches any kind of node.- Returns:
- the builder's state after the operation
-
opcode
Matches a specific opcode.- Parameters:
opcode- opcode to match- Returns:
- the builder's state after the operation
-
opcodes
Matches a list of opcodes.- Parameters:
opcodes- list of opcodes to match- Returns:
- the builder's state after the operation
-
method
Matches a method invocation of any kind: one of INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.- Returns:
- the builder's state after the operation
-
field
Matches a field invocation of any kind: one of GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.- Returns:
- the builder's state after the operation
-
jump
Matches any kind of jump instruction.- Returns:
- the builder's state after the operation
-
label
Matches any kind of label.- Returns:
- the builder's state after the operation
-
node
Matches the given opcode and the exact given arguments. Partial argument matches are not supported: all arguments must be provided for the check to succeed. The expected order of arguments is the one used in the relevant node constructor; where possible, a proxy can substitute the parent/name/descriptor arguments. Lists may be used in place of arrays; varargs will also be supported where the relevant node constructor accepted them. Raw labels may be used in place of LabelNodes. Matches made using method are the safest, but other tests are generally faster, although the difference will likely be negligible in nearly all use cases.- Parameters:
opcode- the opcodeargs- the arguments (you may use proxies in place of name/descriptors)- Returns:
- the builder's state after the operation
-
ignoreLabels
Tells the pattern matcher to ignore LABEL nodes.- Returns:
- the builder's state after the operation
-
ignoreFrames
Tells the pattern matcher to ignore FRAME nodes.- Returns:
- the builder's state after the operation
-
ignoreLineNumbers
Tells the pattern matcher to ignore LINENUMBER nodes.- Returns:
- the builder's state after the operation
-
ignoreNoOps
Tells the pattern matcher to ignore all no-ops.- Returns:
- the builder's state after the operation
-