Package com.io7m.changelog.parser.api
Class CParseError
java.lang.Object
com.io7m.changelog.parser.api.CParseError
- All Implemented Interfaces:
CParseErrorType
The type of parse errors.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.io7m.changelog.parser.api.CParseErrorType
CParseErrorType.Severity -
Method Summary
Modifier and TypeMethodDescriptionstatic CParseError.Builderbuilder()Creates a builder forCParseError.static CParseErrorcopyOf(CParseErrorType instance) Creates an immutable copy of aCParseErrorTypevalue.booleanThis instance is equal to all instances ofCParseErrorthat have equal attribute values.inthashCode()Computes a hash code from attributes:lexical,severity,message,exception.com.io7m.jlexing.core.LexicalPosition<URI> lexical()message()static CParseErrorof(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CParseErrorType.Severity severity, String message, Optional<? extends Exception> exception) Construct a new immutableCParseErrorinstance.severity()toString()Prints the immutable valueCParseErrorwith attribute values.final CParseErrorwithException(Exception value) Copy the current immutable object by setting a present value for the optionalexceptionattribute.final CParseErrorwithException(Optional<? extends Exception> optional) Copy the current immutable object by setting an optional value for theexceptionattribute.final CParseErrorwithLexical(com.io7m.jlexing.core.LexicalPosition<URI> value) Copy the current immutable object by setting a value for thelexicalattribute.final CParseErrorwithMessage(String value) Copy the current immutable object by setting a value for themessageattribute.final CParseErrorCopy the current immutable object by setting a value for theseverityattribute.
-
Method Details
-
lexical
- Specified by:
lexicalin interfaceCParseErrorType- Returns:
- The lexical position of the error
-
severity
- Specified by:
severityin interfaceCParseErrorType- Returns:
- The severity of the error
-
message
- Specified by:
messagein interfaceCParseErrorType- Returns:
- The error message
-
exception
- Specified by:
exceptionin interfaceCParseErrorType- 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
This instance is equal to all instances ofCParseErrorthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:lexical,severity,message,exception. -
toString
Prints the immutable valueCParseErrorwith attribute values. -
of
public static CParseError of(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CParseErrorType.Severity severity, String message, Optional<? extends Exception> exception) Construct a new immutableCParseErrorinstance.- Parameters:
lexical- The value for thelexicalattributeseverity- The value for theseverityattributemessage- The value for themessageattributeexception- The value for theexceptionattribute- Returns:
- An immutable CParseError instance
-
copyOf
Creates an immutable copy of aCParseErrorTypevalue. 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
-
builder
Creates a builder forCParseError.CParseError.builder() .setLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI>) // requiredlexical.setSeverity(com.io7m.changelog.parser.api.CParseErrorType.Severity) // requiredseverity.setMessage(String) // requiredmessage.setException(Exception) // optionalexception.build();- Returns:
- A new CParseError builder
-