Package com.io7m.smfj.parser.api
Class SMFParseError
- java.lang.Object
-
- com.io7m.smfj.parser.api.SMFParseError
-
- All Implemented Interfaces:
SMFErrorType,SMFParseErrorType
public final class SMFParseError extends java.lang.Object implements SMFParseErrorType
The type of parse errors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSMFParseError.BuilderBuilds instances of typeSMFParseError.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFParseError.Builderbuilder()Creates a builder forSMFParseError.static SMFParseErrorcopyOf(SMFParseErrorType instance)Creates an immutable copy of aSMFParseErrorTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFParseErrorthat have equal attribute values.java.util.Optional<java.lang.Exception>exception()java.lang.StringfullMessage()inthashCode()Computes a hash code from attributes:lexical,message,exception.com.io7m.jlexing.core.LexicalPosition<java.net.URI>lexical()java.lang.Stringmessage()static SMFParseErrorof(com.io7m.jlexing.core.LexicalPosition<java.net.URI> lexical, java.lang.String message, java.util.Optional<? extends java.lang.Exception> exception)Construct a new immutableSMFParseErrorinstance.java.lang.StringtoString()Prints the immutable valueSMFParseErrorwith attribute values.SMFParseErrorwithException(java.lang.Exception value)Copy the current immutable object by setting a present value for the optionalexceptionattribute.SMFParseErrorwithException(java.util.Optional<? extends java.lang.Exception> optional)Copy the current immutable object by setting an optional value for theexceptionattribute.SMFParseErrorwithLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI> value)Copy the current immutable object by setting a value for thelexicalattribute.SMFParseErrorwithMessage(java.lang.String value)Copy the current immutable object by setting a value for themessageattribute.
-
-
-
Method Detail
-
lexical
public com.io7m.jlexing.core.LexicalPosition<java.net.URI> lexical()
- Specified by:
lexicalin interfaceSMFParseErrorType- Returns:
- Lexical information
-
message
public java.lang.String message()
- Specified by:
messagein interfaceSMFErrorType- Specified by:
messagein interfaceSMFParseErrorType- Returns:
- The value of the
messageattribute
-
exception
public java.util.Optional<java.lang.Exception> exception()
- Specified by:
exceptionin interfaceSMFErrorType- Specified by:
exceptionin interfaceSMFParseErrorType- Returns:
- The value of the
exceptionattribute
-
withLexical
public final SMFParseError withLexical(com.io7m.jlexing.core.LexicalPosition<java.net.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
-
withMessage
public final SMFParseError withMessage(java.lang.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 SMFParseError withException(java.lang.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 SMFParseError withException(java.util.Optional<? extends java.lang.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(java.lang.Object another)
This instance is equal to all instances ofSMFParseErrorthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:lexical,message,exception.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFParseErrorwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
fullMessage
public java.lang.String fullMessage()
Returns a lazily initialized value of the
fullMessageattribute. Initialized once and only once and stored for subsequent access with proper synchronization. In case of any exception or error thrown by the lazy value initializer, the result will not be memoised (i.e. remembered) and on next call computation will be attempted again.- Specified by:
fullMessagein interfaceSMFErrorType- Specified by:
fullMessagein interfaceSMFParseErrorType- Returns:
- A lazily initialized value of the
fullMessageattribute
-
of
public static SMFParseError of(com.io7m.jlexing.core.LexicalPosition<java.net.URI> lexical, java.lang.String message, java.util.Optional<? extends java.lang.Exception> exception)
Construct a new immutableSMFParseErrorinstance.- Parameters:
lexical- The value for thelexicalattributemessage- The value for themessageattributeexception- The value for theexceptionattribute- Returns:
- An immutable SMFParseError instance
-
copyOf
public static SMFParseError copyOf(SMFParseErrorType instance)
Creates an immutable copy of aSMFParseErrorTypevalue. 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 SMFParseError instance
-
builder
public static SMFParseError.Builder builder()
Creates a builder forSMFParseError.SMFParseError.builder() .setLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI>) // requiredlexical.setMessage(String) // requiredmessage.setException(Exception) // optionalexception.build();- Returns:
- A new SMFParseError builder
-
-