Package com.io7m.smfj.parser.api
Class SMFParseWarning
- java.lang.Object
-
- com.io7m.smfj.parser.api.SMFParseWarning
-
- All Implemented Interfaces:
SMFWarningType
,SMFParseWarningType
public final class SMFParseWarning extends java.lang.Object implements SMFParseWarningType
The type of parse warnings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SMFParseWarning.Builder
Builds instances of typeSMFParseWarning
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFParseWarning.Builder
builder()
Creates a builder forSMFParseWarning
.static SMFParseWarning
copyOf(SMFParseWarningType instance)
Creates an immutable copy of aSMFParseWarningType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFParseWarning
that have equal attribute values.java.util.Optional<java.lang.Exception>
exception()
java.lang.String
fullMessage()
int
hashCode()
Computes a hash code from attributes:lexical
,message
,exception
.com.io7m.jlexing.core.LexicalPosition<java.net.URI>
lexical()
java.lang.String
message()
static SMFParseWarning
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 immutableSMFParseWarning
instance.java.lang.String
toString()
Prints the immutable valueSMFParseWarning
with attribute values.SMFParseWarning
withException(java.lang.Exception value)
Copy the current immutable object by setting a present value for the optionalexception
attribute.SMFParseWarning
withException(java.util.Optional<? extends java.lang.Exception> optional)
Copy the current immutable object by setting an optional value for theexception
attribute.SMFParseWarning
withLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI> value)
Copy the current immutable object by setting a value for thelexical
attribute.SMFParseWarning
withMessage(java.lang.String value)
Copy the current immutable object by setting a value for themessage
attribute.
-
-
-
Method Detail
-
lexical
public com.io7m.jlexing.core.LexicalPosition<java.net.URI> lexical()
- Specified by:
lexical
in interfaceSMFParseWarningType
- Returns:
- Lexical information
-
message
public java.lang.String message()
- Specified by:
message
in interfaceSMFParseWarningType
- Specified by:
message
in interfaceSMFWarningType
- Returns:
- The value of the
message
attribute
-
exception
public java.util.Optional<java.lang.Exception> exception()
- Specified by:
exception
in interfaceSMFParseWarningType
- Specified by:
exception
in interfaceSMFWarningType
- Returns:
- The value of the
exception
attribute
-
withLexical
public final SMFParseWarning withLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI> value)
Copy the current immutable object by setting a value for thelexical
attribute. 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
this
object
-
withMessage
public final SMFParseWarning withMessage(java.lang.String value)
Copy the current immutable object by setting a value for themessage
attribute. 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
this
object
-
withException
public final SMFParseWarning withException(java.lang.Exception value)
Copy the current immutable object by setting a present value for the optionalexception
attribute.- Parameters:
value
- The value for exception- Returns:
- A modified copy of
this
object
-
withException
public final SMFParseWarning withException(java.util.Optional<? extends java.lang.Exception> optional)
Copy the current immutable object by setting an optional value for theexception
attribute. 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
this
object
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFParseWarning
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:lexical
,message
,exception
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFParseWarning
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
fullMessage
public java.lang.String fullMessage()
Returns a lazily initialized value of the
fullMessage
attribute. 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:
fullMessage
in interfaceSMFParseWarningType
- Specified by:
fullMessage
in interfaceSMFWarningType
- Returns:
- A lazily initialized value of the
fullMessage
attribute
-
of
public static SMFParseWarning 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 immutableSMFParseWarning
instance.- Parameters:
lexical
- The value for thelexical
attributemessage
- The value for themessage
attributeexception
- The value for theexception
attribute- Returns:
- An immutable SMFParseWarning instance
-
copyOf
public static SMFParseWarning copyOf(SMFParseWarningType instance)
Creates an immutable copy of aSMFParseWarningType
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 SMFParseWarning instance
-
builder
public static SMFParseWarning.Builder builder()
Creates a builder forSMFParseWarning
.SMFParseWarning.builder() .setLexical(com.io7m.jlexing.core.LexicalPosition<java.net.URI>) // required
lexical
.setMessage(String) // requiredmessage
.setException(Exception) // optionalexception
.build();- Returns:
- A new SMFParseWarning builder
-
-