Package e.java
Class E
java.lang.Object
e.java.E
A generic and immutable error, containing helpful information
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConstructs an E adding given causeConstructs an E adding given cause if condition holdscauses()
Constructs an E adding given causesConstructs an E adding given causescode()
code
(int c) Constructs an E containing given codedata()
<V> E
Constructs an E adding given data entryConstructs an E adding given databoolean
static E
Constructs an E adding given causestatic E
fromCauseIf
(boolean condition, Supplier<E> e) Constructs an E adding given cause if condition holdsstatic E
fromCauses
(E... c) Constructs an E adding given causesstatic E
fromCauses
(List<E> c) Constructs an E adding given causesstatic E
fromCode
(int c) Constructs an E containing given codestatic <V> E
Constructs an E adding given data entrystatic E
Constructs an E adding given datastatic E
Constructs an E containing given messagestatic E
Constructs an E containing given namestatic E
fromNow()
Constructs an E containing time set to nowstatic E
fromThrowable
(Throwable throwable) Constructs an E from given [kotlin.Throwable]static E
Constructs an E containing given timeboolean
hasCause()
boolean
hasCode()
boolean
hasData()
int
hashCode()
boolean
boolean
hasName()
boolean
hasTime()
message()
Constructs an E containing given messagename()
Constructs an E containing given namenow()
Constructs an E containing time set to nowtime()
time
(long t) Constructs an E containing given time<A> EOr<A>
toEOr()
Converts this E to a failed EOr<A>Converts this E into an exceptiontoString()
-
Field Details
-
empty
An empty E
-
-
Constructor Details
-
Method Details
-
code
- Returns:
code
or emptyOptional
if code is not set
-
name
- Returns:
name
or emptyOptional
if name is not set
-
message
- Returns:
message
or emptyOptional
if message is not set
-
causes
- Returns:
causes
or emptyList
if causes are not set
-
data
- Returns:
data
or emptyMap
if data are not set
-
time
- Returns:
time
or emptyOptional
if time is not set
-
code
Constructs an E containing given code- Parameters:
c
- A code- Returns:
- A new E containing given code
-
name
Constructs an E containing given name- Parameters:
n
- A name- Returns:
- A new E containing given name
-
message
Constructs an E containing given message- Parameters:
m
- Message to set- Returns:
- A new E containing given message
-
causes
Constructs an E adding given causes- Parameters:
c
- Causes as a List- Returns:
- A new E containing causes of this E and given causes
-
causes
Constructs an E adding given causes- Parameters:
c
- Causes as variable arguments- Returns:
- A new E containing causes of this E and given causes
-
cause
Constructs an E adding given cause- Parameters:
e
- A cause- Returns:
- A new E containing causes of this E and given causes
-
data
Constructs an E adding given data- Parameters:
d
- Data as a key-value map- Returns:
- A new E containing data of this E and given data
-
data
Constructs an E adding given data entry- Type Parameters:
V
- Type of value of data entry- Parameters:
k
- Key of data entryv
- Value of data entry- Returns:
- A new E containing data of this E and given data entry
-
time
Constructs an E containing given time- Parameters:
t
- A time- Returns:
- A new E containing given time
-
now
Constructs an E containing time set to now- Returns:
- A new E containing time set to now
- See Also:
-
causeIf
Constructs an E adding given cause if condition holds- Parameters:
condition
- Some condition on which to add the causee
- A cause- Returns:
- A new E containing causes of this E and given cause or this E as is if condition doesn't hold
-
hasCode
public boolean hasCode()- Returns:
- Whether or not a code is set
-
hasName
public boolean hasName()- Returns:
- Whether or not a name is set
-
hasMessage
public boolean hasMessage()- Returns:
- Whether or not a message is set
-
hasCause
public boolean hasCause()- Returns:
- Whether or not a cause is set
-
hasData
public boolean hasData()- Returns:
- Whether or not a data is set
-
hasTime
public boolean hasTime()- Returns:
- Whether or not a time is set
-
toEOr
Converts this E to a failed EOr<A>- Type Parameters:
A
- The A type in resulting EOr- Returns:
- An EOr<A> containing this E
- See Also:
-
toException
Converts this E into an exception- Returns:
- An
EException
containing this E
-
equals
-
hashCode
public int hashCode() -
toString
-
fromCode
Constructs an E containing given code- Parameters:
c
- A code- Returns:
- A new E containing given code
-
fromName
Constructs an E containing given name- Parameters:
n
- A name- Returns:
- A new E containing given name
-
fromMessage
Constructs an E containing given message- Parameters:
m
- Message to set- Returns:
- A new E containing given message
-
fromCauses
Constructs an E adding given causes- Parameters:
c
- Causes as a List- Returns:
- A new E containing causes of this E and given causes
-
fromCauses
Constructs an E adding given causes- Parameters:
c
- Causes as variable arguments- Returns:
- A new E containing causes of this E and given causes
-
fromCause
Constructs an E adding given cause- Parameters:
e
- A cause- Returns:
- A new E containing causes of this E and given causes
-
fromData
Constructs an E adding given data- Parameters:
d
- Data as a key-value map- Returns:
- A new E containing data of this E and given data
-
fromData
Constructs an E adding given data entry- Type Parameters:
V
- Type of value of data entry- Parameters:
k
- Key of data entryv
- Value of data entry- Returns:
- A new E containing data of this E and given data entry
-
fromTime
Constructs an E containing given time- Parameters:
t
- A time- Returns:
- A new E containing given time
-
fromNow
Constructs an E containing time set to now- Returns:
- A new E containing time set to now
- See Also:
-
fromCauseIf
Constructs an E adding given cause if condition holds- Parameters:
condition
- Some condition on which to add the causee
- A cause- Returns:
- A new E containing causes of this E and given cause or this E as is if condition doesn't hold
-
fromThrowable
Constructs an E from given [kotlin.Throwable]- Parameters:
throwable
- A Throwable- Returns:
- A new E containing message of given Throwable or wrapped E in EException if Throwable is one
-