Package cs1302.tracer.trace
Record Class BreakpointSpec
java.lang.Object
java.lang.Record
cs1302.tracer.trace.BreakpointSpec
- Record Components:
file- The optional source file name or relative path.lineNumber- The 1-based source line number, or -1 for end of main execution.
Specification for a breakpoint target, which may be unqualified (line number only)
or file-qualified (relative source file or class name with line number).
-
Constructor Summary
ConstructorsConstructorDescriptionBreakpointSpec(Optional<String> file, int lineNumber) Constructs a validated BreakpointSpec. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.file()Returns the value of thefilerecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of thelineNumberrecord component.booleanmatchesReferenceType(ReferenceType refType) Checks if this breakpoint specification matches a JDI reference type.booleanmatchesSourcePath(String sourcePath) Checks if this breakpoint specification matches a given source file path.static BreakpointSpecof(int lineNumber) Creates an unqualified breakpoint specification for a line number.static BreakpointSpecCreates a file-qualified breakpoint specification.static BreakpointSpecParses a breakpoint string into a BreakpointSpec.toString()Returns a human-readable representation of this breakpoint spec.
-
Constructor Details
-
BreakpointSpec
Constructs a validated BreakpointSpec.- Parameters:
file- Optional file qualification.lineNumber- Line number (1-based or -1).
-
-
Method Details
-
of
Creates an unqualified breakpoint specification for a line number.- Parameters:
lineNumber- Line number.- Returns:
- BreakpointSpec instance.
-
of
Creates a file-qualified breakpoint specification.- Parameters:
file- Source file name or relative path.lineNumber- Line number.- Returns:
- BreakpointSpec instance.
-
parse
Parses a breakpoint string into a BreakpointSpec.Supported formats include:
"12"- unqualified line number 12"Foo.java:12"- line 12 in Foo.java"pkg/Foo.java:12"- line 12 in pkg/Foo.java"-1"- end of main execution
- Parameters:
spec- The raw specification string.- Returns:
- Parsed BreakpointSpec.
- Throws:
IllegalArgumentException- If syntax is invalid or line number cannot be parsed.
-
matchesSourcePath
Checks if this breakpoint specification matches a given source file path.- Parameters:
sourcePath- Relative source file path.- Returns:
- True if this specification matches the given path.
-
matchesReferenceType
Checks if this breakpoint specification matches a JDI reference type.- Parameters:
refType- The JDI ReferenceType to inspect.- Returns:
- True if this specification applies to the reference type.
-
toString
Returns a human-readable representation of this breakpoint spec. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
file
Returns the value of thefilerecord component.- Returns:
- the value of the
filerecord component
-
lineNumber
public int lineNumber()Returns the value of thelineNumberrecord component.- Returns:
- the value of the
lineNumberrecord component
-