Class CParseError

    • Method Detail

      • lexical

        public com.io7m.jlexing.core.LexicalPosition<URI> lexical()
        Specified by:
        lexical in interface CParseErrorType
        Returns:
        The lexical position of the error
      • withLexical

        public final CParseError withLexical​(com.io7m.jlexing.core.LexicalPosition<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 CParseError withSeverity​(CParseErrorType.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 CParseError withMessage​(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 CParseError withException​(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 CParseError withException​(Optional<? extends 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​(Object another)
        This instance is equal to all instances of CParseError that have equal attribute values.
        Overrides:
        equals in class 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 Object
        Returns:
        hashCode value
      • toString

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

        public static CParseError of​(com.io7m.jlexing.core.LexicalPosition<URI> lexical,
                                     CParseErrorType.Severity severity,
                                     String message,
                                     Optional<? extends Exception> exception)
        Construct a new immutable CParseError instance.
        Parameters:
        lexical - The value for the lexical attribute
        severity - The value for the severity attribute
        message - The value for the message attribute
        exception - The value for the exception attribute
        Returns:
        An immutable CParseError instance
      • copyOf

        public static CParseError copyOf​(CParseErrorType instance)
        Creates an immutable copy of a CParseErrorType 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 CParseError instance