- java.lang.Object
-
- com.io7m.changelog.parser.api.CParseError
-
- All Implemented Interfaces:
CParseErrorType
public final class CParseError extends Object implements CParseErrorType
The type of parse errors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCParseError.BuilderBuilds instances of typeCParseError.-
Nested classes/interfaces inherited from interface com.io7m.changelog.parser.api.CParseErrorType
CParseErrorType.Severity
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CParseError.Builderbuilder()Creates a builder forCParseError.static CParseErrorcopyOf(CParseErrorType instance)Creates an immutable copy of aCParseErrorTypevalue.booleanequals(Object another)This instance is equal to all instances ofCParseErrorthat have equal attribute values.Optional<Exception>exception()inthashCode()Computes a hash code from attributes:lexical,severity,message,exception.com.io7m.jlexing.core.LexicalPosition<URI>lexical()Stringmessage()static CParseErrorof(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CParseErrorType.Severity severity, String message, Optional<? extends Exception> exception)Construct a new immutableCParseErrorinstance.CParseErrorType.Severityseverity()StringtoString()Prints the immutable valueCParseErrorwith attribute values.CParseErrorwithException(Exception value)Copy the current immutable object by setting a present value for the optionalexceptionattribute.CParseErrorwithException(Optional<? extends Exception> optional)Copy the current immutable object by setting an optional value for theexceptionattribute.CParseErrorwithLexical(com.io7m.jlexing.core.LexicalPosition<URI> value)Copy the current immutable object by setting a value for thelexicalattribute.CParseErrorwithMessage(String value)Copy the current immutable object by setting a value for themessageattribute.CParseErrorwithSeverity(CParseErrorType.Severity value)Copy the current immutable object by setting a value for theseverityattribute.
-
-
-
Method Detail
-
lexical
public com.io7m.jlexing.core.LexicalPosition<URI> lexical()
- Specified by:
lexicalin interfaceCParseErrorType- Returns:
- The lexical position of the error
-
severity
public CParseErrorType.Severity severity()
- Specified by:
severityin interfaceCParseErrorType- Returns:
- The severity of the error
-
message
public String message()
- Specified by:
messagein interfaceCParseErrorType- Returns:
- The error message
-
exception
public Optional<Exception> exception()
- Specified by:
exceptionin interfaceCParseErrorType- Returns:
- The exception raised, if any
-
withLexical
public final CParseError withLexical(com.io7m.jlexing.core.LexicalPosition<URI> value)
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
public final CParseError withSeverity(CParseErrorType.Severity value)
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
public final CParseError withMessage(String value)
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
public final CParseError withException(Exception value)
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
public final CParseError withException(Optional<? extends Exception> optional)
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(Object another)
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
public String 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
public static CParseError copyOf(CParseErrorType instance)
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
public static CParseError.Builder builder()
Creates a builder forCParseError.- Returns:
- A new CParseError builder
-
-