Class BerMutations
java.lang.Object
org.snmp4j.mcp.tool.snmp.ber.BerMutations
Applies declarative mutations and computes permutations over a BER node tree (the plain
Map/List form parsed from the snmp_message_ber JSON).
Mutations and permutation dimensions address nodes with a small subset of JSON Pointer
(RFC 6901): "" is the root, "/children/1/children/0" descends into arrays and
object members. Supported operations set the encoder's per-node fields (see
BerJsonEncoder): setTag, setValue, setValueHex,
overrideLength, lengthForm, truncate, omit, appendHex,
setRawHex, and flipBit (flip one bit of the addressed leaf's current content).
- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResult of expanding a permutation spec. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyMutations(Object root, List<?> mutations) Applies a list of mutation operations in order, in place, toroot.static voidApplies a single operation to a target node.static ObjectDeep-copies a Map/List/primitive tree so mutations don't touch the template.static BerMutations.ExpansionExpands a permutation spec into a set of mutated node trees.static ObjectresolveNode(Object root, String pointer) Resolves a JSON Pointer against the tree and returns the addressed node.
-
Method Details
-
applyMutations
-
applyOp
-
expand
Expands a permutation spec into a set of mutated node trees.- Parameters:
base- the template node tree (already mutated, if applicable)spec- the permutation spec:{"mode":"cartesian|zip","limit":N,"dimensions":[...]}limit- the maximum number of trees to produce- Returns:
- the expansion result
-
resolveNode
Resolves a JSON Pointer against the tree and returns the addressed node.- Parameters:
root- the treepointer- an RFC 6901 pointer (""for root)- Returns:
- the addressed object
- Throws:
IllegalArgumentException- if the pointer does not resolve
-
deepCopy
-