Class WXMParseError

java.lang.Object
com.io7m.waxmill.parser.api.WXMParseError
All Implemented Interfaces:
com.io7m.jlexing.core.LexicalType<java.net.URI>, WXMParseErrorType

public final class WXMParseError
extends java.lang.Object
implements WXMParseErrorType
The type of parse errors.
  • Method Details

    • 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 WXMParseErrorType
      Returns:
      The value of the lexical attribute
    • severity

      public WXMParseErrorType.Severity severity()
      Specified by:
      severity in interface WXMParseErrorType
      Returns:
      The severity of the error
    • message

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

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

      public final WXMParseError 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 WXMParseError withSeverity​(WXMParseErrorType.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 WXMParseError 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 WXMParseError 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 WXMParseError 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 WXMParseError 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 WXMParseError with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

      public static WXMParseError copyOf​(WXMParseErrorType instance)
      Creates an immutable copy of a WXMParseErrorType 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 WXMParseError instance
    • builder

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