Class ParseError
java.lang.Object
com.io7m.coffeepick.runtime.parser.spi.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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParseError.BuilderBuilds instances of typeParseError.Nested classes/interfaces inherited from interface com.io7m.coffeepick.runtime.parser.spi.ParseErrorType
ParseErrorType.Severity -
Method Summary
Modifier and Type Method Description static ParseError.Builderbuilder()Creates a builder forParseError.static ParseErrorcopyOf(ParseErrorType instance)Creates an immutable copy of aParseErrorTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofParseErrorthat have equal attribute values.java.util.Optional<java.lang.Exception>exception()inthashCode()Computes a hash code from attributes:lexical,severity,message,exception.com.io7m.jlexing.core.LexicalPosition<java.net.URI>lexical()java.lang.Stringmessage()ParseErrorType.Severityseverity()java.lang.StringtoString()Prints the immutable valueParseErrorwith attribute values.ParseErrorwithException(java.lang.Exception value)Copy the current immutable object by setting a present value for the optionalexceptionattribute.ParseErrorwithException(java.util.Optional<? extends java.lang.Exception> optional)Copy the current immutable object by setting an optional value for theexceptionattribute.ParseErrorwithLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI> value)Copy the current immutable object by setting a value for thelexicalattribute.ParseErrorwithMessage(java.lang.String value)Copy the current immutable object by setting a value for themessageattribute.ParseErrorwithSeverity(ParseErrorType.Severity value)Copy the current immutable object by setting a value for theseverityattribute.
-
Method Details
-
lexical
public com.io7m.jlexing.core.LexicalPosition<java.net.URI> lexical()- Specified by:
lexicalin interfacecom.io7m.jlexing.core.LexicalType<java.net.URI>- Specified by:
lexicalin interfaceParseErrorType- Returns:
- The value of the
lexicalattribute
-
severity
- Specified by:
severityin interfaceParseErrorType- Returns:
- The error severity
-
message
public java.lang.String message()- Specified by:
messagein interfaceParseErrorType- Returns:
- The error message
-
exception
public java.util.Optional<java.lang.Exception> exception()- Specified by:
exceptionin interfaceParseErrorType- Returns:
- The exception raised, if any
-
withLexical
Copy the current immutable object by setting a value for thelexicalattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for lexical- Returns:
- A modified copy of the
thisobject
-
withSeverity
Copy the current immutable object by setting a value for theseverityattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for severity- Returns:
- A modified copy of the
thisobject
-
withMessage
Copy the current immutable object by setting a value for themessageattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for message- Returns:
- A modified copy of the
thisobject
-
withException
Copy the current immutable object by setting a present value for the optionalexceptionattribute.- Parameters:
value- The value for exception- Returns:
- A modified copy of
thisobject
-
withException
Copy the current immutable object by setting an optional value for theexceptionattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for exception- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofParseErrorthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:lexical,severity,message,exception.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueParseErrorwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aParseErrorTypevalue. 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
Creates a builder forParseError.ParseError.builder() .setLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI>) // requiredlexical.setSeverity(com.io7m.coffeepick.runtime.parser.spi.ParseErrorType.Severity) // requiredseverity.setMessage(String) // requiredmessage.setException(Exception) // optionalexception.build();- Returns:
- A new ParseError builder
-