Package fr.bl.drit.flow.agent
Class MethodIdMapping
java.lang.Object
fr.bl.drit.flow.agent.MethodIdMapping
Mapping of method keys (e.g. "com.example.MyClass#myMethod(Ljava/lang/String;)V") to numeric IDs
used in the recorded traces. This is thread-safe and assigns new IDs on demand. The mapping can
be initialized from an existing file to preserve or optimize method IDs across runs, and can be
dumped to a file for future reuse.
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize a blank mapping.MethodIdMapping(Path input) Initialize mapping from an existing file, to preserve or optimize method IDs across runs. -
Method Summary
-
Constructor Details
-
MethodIdMapping
public MethodIdMapping()Initialize a blank mapping. -
MethodIdMapping
Initialize mapping from an existing file, to preserve or optimize method IDs across runs.- Parameters:
input- Path to file containing lines of "key=id" generated bydump(Path)in a previous run.- Throws:
IOException- If an I/O error occurs when opening or reading the file.
-
-
Method Details
-
idFor
Get or compute a method ID for a given method.- Parameters:
key- Method signature- Returns:
- Method ID
-
size
public int size()- Returns:
- Number of methods in the mapping
-
dump
Dump the mapping to a file.- Parameters:
output- Path to output file- Throws:
IOException- If an I/O error occurs when opening the file.
-
dump
Dump the mapping to a file, for potential reuse in future runs. Format is lines of "key=id".- Parameters:
mapping- Map of signature -> IDoutput- Path to output file- Throws:
IOException- If an I/O error occurs when opening or writing the file.
-