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> EConstructs an E adding given data entryConstructs an E adding given databooleanstatic EConstructs an E adding given causestatic EfromCauseIf(boolean condition, Supplier<E> e) Constructs an E adding given cause if condition holdsstatic EfromCauses(E... c) Constructs an E adding given causesstatic EfromCauses(List<E> c) Constructs an E adding given causesstatic EfromCode(int c) Constructs an E containing given codestatic <V> EConstructs an E adding given data entrystatic EConstructs an E adding given datastatic EConstructs an E containing given messagestatic EConstructs an E containing given namestatic EfromNow()Constructs an E containing time set to nowstatic EfromThrowable(Throwable throwable) Constructs an E from given [kotlin.Throwable]static EConstructs an E containing given timebooleanhasCause()booleanhasCode()booleanhasData()inthashCode()booleanbooleanhasName()booleanhasTime()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:
codeor emptyOptionalif code is not set
-
name
- Returns:
nameor emptyOptionalif name is not set
-
message
- Returns:
messageor emptyOptionalif message is not set
-
causes
- Returns:
causesor emptyListif causes are not set
-
data
- Returns:
dataor emptyMapif data are not set
-
time
- Returns:
timeor emptyOptionalif 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
EExceptioncontaining 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
-