Class FilePosition
- java.lang.Object
-
- org.junit.platform.engine.discovery.FilePosition
-
- All Implemented Interfaces:
java.io.Serializable
@API(status=STABLE, since="1.7") public class FilePosition extends java.lang.Object implements java.io.Serializable- Since:
- 1.7
- See Also:
- Serialized Form
- Implementation Note:
- This class is a copy of
FilePosition, which is not accessible from this package. The decision to duplicate it is motivated by an eventual divergence between the two classes in the future.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static FilePositionfrom(int line)Create a newFilePositionusing the suppliedlinenumber and an undefined column number.static FilePositionfrom(int line, int column)Create a newFilePositionusing the suppliedlineandcolumnnumbers.static java.util.Optional<FilePosition>fromQuery(java.lang.String query)Create an optionalFilePositionby parsing the suppliedquerystring.java.util.Optional<java.lang.Integer>getColumn()Get the column number of thisFilePosition, if available.intgetLine()Get the line number of thisFilePosition.inthashCode()java.lang.StringtoString()
-
-
-
Method Detail
-
from
public static FilePosition from(int line)
Create a newFilePositionusing the suppliedlinenumber and an undefined column number.- Parameters:
line- the line number; must be greater than zero- Returns:
- a
FilePositionwith the given line number
-
from
public static FilePosition from(int line, int column)
Create a newFilePositionusing the suppliedlineandcolumnnumbers.- Parameters:
line- the line number; must be greater than zerocolumn- the column number; must be greater than zero- Returns:
- a
FilePositionwith the given line and column numbers
-
fromQuery
public static java.util.Optional<FilePosition> fromQuery(java.lang.String query)
Create an optionalFilePositionby parsing the suppliedquerystring.Examples of valid
querystrings:"line=23""line=23&column=42"
- Parameters:
query- the query string; may benull- Returns:
- an
Optionalcontaining aFilePositionwith the parsed line and column numbers; nevernullbut potentially empty - Since:
- 1.3
- See Also:
from(int),from(int, int)
-
getLine
public int getLine()
Get the line number of thisFilePosition.- Returns:
- the line number
-
getColumn
public java.util.Optional<java.lang.Integer> getColumn()
Get the column number of thisFilePosition, if available.- Returns:
- an
Optionalcontaining the column number; nevernullbut potentially empty
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-