-
public final class E
A generic and immutable error, containing helpful information
-
-
Field Summary
Fields Modifier and Type Field Description private final Boolean
hasCode
private final Boolean
hasName
private final Boolean
hasMessage
private final Boolean
hasCause
private final Boolean
hasData
private final Boolean
hasTime
private final Integer
code
private final String
name
private final String
message
private final List<E>
causes
private final Map<String, String>
data
private final Long
time
-
Method Summary
Modifier and Type Method Description final E
code(Integer c)
Constructs an E containing given code final E
name(String n)
Constructs an E containing given name final E
message(String m)
Constructs an E containing given message final E
causes(List<E> c)
Constructs an E adding given causes final E
causes(Array<Out E> c)
Constructs an E adding given causes final E
cause(E e)
Constructs an E adding given cause final E
data(Map<String, String> d)
Constructs an E adding given data final <V extends Any> E
data(String k, V v)
Constructs an E adding given data entry final <V extends Any> E
data(Pair<String, V> p)
Constructs an E adding given data entry final E
time(Long t)
Constructs an E containing given time final E
now()
Constructs an E containing time set to now final E
causeIf(Boolean condition, Function0<E> e)
Constructs an E adding given cause if condition holds final <A extends Any> EOr<A>
toEOr()
Converts this E to a failed EOr<A> final EException
toException()
Converts this E into an exception String
toString()
final Integer
component1()
final String
component2()
final String
component3()
final List<E>
component4()
final Map<String, String>
component5()
final Long
component6()
final E
copy(Integer code, String name, String message, List<E> causes, Map<String, String> data, Long time)
final Boolean
getHasCode()
Whether or not a code is set final Boolean
getHasName()
Whether or not a name is set final Boolean
getHasMessage()
Whether or not a message is set final Boolean
getHasCause()
Whether or not a cause is set final Boolean
getHasData()
Whether or not a data is set final Boolean
getHasTime()
Whether or not a time is set final Integer
getCode()
final String
getName()
final String
getMessage()
final List<E>
getCauses()
final Map<String, String>
getData()
final Long
getTime()
-
-
Method Detail
-
message
final E message(String m)
Constructs an E containing given message- Parameters:
m
- Message to set
-
causes
final E causes(List<E> c)
Constructs an E adding given causes- Parameters:
c
- Causes as a List
-
causes
final E causes(Array<Out E> c)
Constructs an E adding given causes- Parameters:
c
- Causes as variable arguments
-
data
final E data(Map<String, String> d)
Constructs an E adding given data- Parameters:
d
- Data as a key-value map
-
data
final <V extends Any> E data(String k, V v)
Constructs an E adding given data entry- Parameters:
k
- Key of data entryv
- Value of data entry
-
data
final <V extends Any> E data(Pair<String, V> p)
Constructs an E adding given data entry- Parameters:
p
- Data entry
-
causeIf
final E causeIf(Boolean condition, Function0<E> e)
Constructs an E adding given cause if condition holds- Parameters:
condition
- Some condition on which to add the causee
- A cause
-
toException
final EException toException()
Converts this E into an exception
-
component1
final Integer component1()
-
component2
final String component2()
-
component3
final String component3()
-
component4
final List<E> component4()
-
component5
final Map<String, String> component5()
-
component6
final Long component6()
-
copy
final E copy(Integer code, String name, String message, List<E> causes, Map<String, String> data, Long time)
-
getHasCode
final Boolean getHasCode()
Whether or not a code is set
-
getHasName
final Boolean getHasName()
Whether or not a name is set
-
getHasMessage
final Boolean getHasMessage()
Whether or not a message is set
-
getHasCause
final Boolean getHasCause()
Whether or not a cause is set
-
getHasData
final Boolean getHasData()
Whether or not a data is set
-
getHasTime
final Boolean getHasTime()
Whether or not a time is set
-
getMessage
final String getMessage()
-
-
-
-