Class FilePosition

    • Method Detail

      • from

        public static FilePosition from​(int line)
        Create a new FilePosition using the supplied line number and an undefined column number.
        Parameters:
        line - the line number; must be greater than zero
        Returns:
        a FilePosition with the given line number
      • from

        public static FilePosition from​(int line,
                                        int column)
        Create a new FilePosition using the supplied line and column numbers.
        Parameters:
        line - the line number; must be greater than zero
        column - the column number; must be greater than zero
        Returns:
        a FilePosition with the given line and column numbers
      • fromQuery

        public static Optional<FilePosition> fromQuery​(String query)
        Create an optional FilePosition by parsing the supplied query string.

        Examples of valid query strings:

        • "line=23"
        • "line=23&column=42"
        Parameters:
        query - the query string; may be null
        Returns:
        an Optional containing a FilePosition with the parsed line and column numbers; never null but potentially empty
        Since:
        1.3
        See Also:
        from(int), from(int, int)
      • getLine

        public int getLine()
        Get the line number of this FilePosition.
        Returns:
        the line number
      • getColumn

        public Optional<Integer> getColumn()
        Get the column number of this FilePosition, if available.
        Returns:
        an Optional containing the column number; never null but potentially empty
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object