Class ParseError

  • All Implemented Interfaces:
    ParseErrorType, com.io7m.jlexing.core.LexicalType<java.net.URI>

    public final class ParseError
    extends java.lang.Object
    implements ParseErrorType
    The type of parse errors.
    • Method Detail

      • lexical

        public com.io7m.jlexing.core.LexicalPosition<java.net.URI> lexical()
        Specified by:
        lexical in interface com.io7m.jlexing.core.LexicalType<java.net.URI>
        Specified by:
        lexical in interface ParseErrorType
        Returns:
        The value of the lexical attribute
      • message

        public java.lang.String message()
        Specified by:
        message in interface ParseErrorType
        Returns:
        The error message
      • exception

        public java.util.Optional<java.lang.Exception> exception()
        Specified by:
        exception in interface ParseErrorType
        Returns:
        The exception raised, if any
      • withLexical

        public final ParseError withLexical​(com.io7m.jlexing.core.LexicalPosition<java.net.URI> value)
        Copy the current immutable object by setting a value for the lexical attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for lexical
        Returns:
        A modified copy of the this object
      • withSeverity

        public final ParseError withSeverity​(ParseErrorType.Severity value)
        Copy the current immutable object by setting a value for the severity attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for severity
        Returns:
        A modified copy of the this object
      • withMessage

        public final ParseError withMessage​(java.lang.String value)
        Copy the current immutable object by setting a value for the message attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for message
        Returns:
        A modified copy of the this object
      • withException

        public final ParseError withException​(java.lang.Exception value)
        Copy the current immutable object by setting a present value for the optional exception attribute.
        Parameters:
        value - The value for exception
        Returns:
        A modified copy of this object
      • withException

        public final ParseError withException​(java.util.Optional<? extends java.lang.Exception> optional)
        Copy the current immutable object by setting an optional value for the exception attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for exception
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(java.lang.Object another)
        This instance is equal to all instances of ParseError that have equal attribute values.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: lexical, severity, message, exception.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

        public java.lang.String toString()
        Prints the immutable value ParseError with attribute values.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the value
      • copyOf

        public static ParseError copyOf​(ParseErrorType instance)
        Creates an immutable copy of a ParseErrorType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable ParseError instance
      • builder

        public static ParseError.Builder builder()
        Creates a builder for ParseError.
         ParseError.builder()
            .setLexical(com.io7m.jlexing.core.LexicalPosition&lt;java.net.URI&gt;) // required lexical
            .setSeverity(com.io7m.coffeepick.runtime.parser.spi.ParseErrorType.Severity) // required severity
            .setMessage(String) // required message
            .setException(Exception) // optional exception
            .build();
         
        Returns:
        A new ParseError builder