Package de.srsoftware.tools.container
Klasse Error<None>
java.lang.Object
de.srsoftware.tools.container.Error<None>
- Typparameter:
None- This result is not expected to carry a payload in the sense of a positive execution result.
- Alle implementierten Schnittstellen:
Container<None>
This class may be returned by methods whose execution failed.
It may carry additional data about the cause of the failure
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungadd an exception to this Error objectAdd values to the data mapdata()return the data mapstatic <T> Error<T> create a new Error object carrying the passed messagestatic <T> Error<T> create a new Error object carrying the passed messagestatic <T> Error<T> error(Collection<Exception> exceptions, String message, Object... fills) create a new Error object carrying the passed messagestatic <T> Error<T> create a new Error object carrying the passed messagestatic <T> Error<T> create a new Error object carrying the passed messagestatic <T> Error<T> create a new Error object carrying the passed messageget the collection of Exceptions added to this Error objectbooleanisEmpty()checks whether the object returned by optional() is emptyorg.json.JSONObjectjson()Create a json object of the error.message()return the message encapsulated in this error objectoptional()Create an Optional from a Result.<Inner> Stream<Inner> stream()Create a stream of the Payload.Create a stream of the Payload.<T> Tmap an error to another objecttoString()<NewType> Error<NewType> create an Error with the same metadata content as this Object, but with different payload typewrap()Wrap an error object as Optional
-
Felddetails
-
DATA
data- Siehe auch:
-
EXCEPTIONS
exceptions- Siehe auch:
-
MESSAGE
message- Siehe auch:
-
-
Konstruktordetails
-
Error
create a new Error object carrying the passed message- Parameter:
message- the message to add to the Error objectdata- (optional) data to carry alongexceptions- (optional) exceptions to wrap
-
-
Methodendetails
-
add
add an exception to this Error object- Parameter:
exception- the exception to add- Gibt zurück:
- this object
-
addData
Add values to the data map- Parameter:
tokens- a list of objects. The even elements are used as key in the data map, the odd ones as values.- Gibt zurück:
- this Error object
-
data
return the data map- Gibt zurück:
- metadata added to this Error object
-
error
create a new Error object carrying the passed message- Typparameter:
T- the type of the result expected at the place this error occurred- Parameter:
message- the message to add to the Error object, may contain placeholder marksfills- the list of objects to fill the marks- Gibt zurück:
- the created Error object
-
error
create a new Error object carrying the passed message- Typparameter:
T- the type of the result expected at the place this error occurred- Parameter:
exception- exception to wrapmessage- the message to add to the Error object, may contain placeholder marksfills- the list of objects to fill the marks- Gibt zurück:
- the created Error object
-
error
create a new Error object carrying the passed message- Typparameter:
T- the type of the result expected at the place this error occurred- Parameter:
exceptions- (optional) exceptions to wrapmessage- the message to add to the Error object, may contain placeholder marksfills- the list of objects to fill the marks- Gibt zurück:
- the created Error object
-
error
create a new Error object carrying the passed message- Typparameter:
T- the type of the result expected at the place this error occurred- Parameter:
data- (optional) data to carry alongmessage- the message to add to the Error object, may contain placeholder marksfills- the list of objects to fill the marks- Gibt zurück:
- the created Error object
-
error
public static <T> Error<T> error(Map<String, Object> data, Exception exception, String message, Object... fills) create a new Error object carrying the passed message- Typparameter:
T- the type of the result expected at the place this error occurred- Parameter:
data- (optional) data to carry alongexception- exceptions to wrapmessage- the message to add to the Error object, may contain placeholder marksfills- the list of objects to fill the marks- Gibt zurück:
- the created Error object
-
error
public static <T> Error<T> error(Map<String, Object> data, Collection<Exception> exceptions, String message, Object... fills) create a new Error object carrying the passed message- Typparameter:
T- the type of the result expected at the place this error occurred- Parameter:
data- (optional) data to carry alongexceptions- (optional) exceptions to wrapmessage- the message to add to the Error object, may contain placeholder marksfills- the list of objects to fill the marks- Gibt zurück:
- the created Error object
-
exceptions
get the collection of Exceptions added to this Error object- Gibt zurück:
- the list of Exceptions
-
isEmpty
public boolean isEmpty()Beschreibung aus Schnittstelle kopiert:Containerchecks whether the object returned by optional() is empty -
json
public org.json.JSONObject json()Create a json object of the error.- Gibt zurück:
- the json object describing the error.
-
message
return the message encapsulated in this error object- Gibt zurück:
- the message string
-
optional
Beschreibung aus Schnittstelle kopiert:ContainerCreate an Optional from a Result. -
stream
Beschreibung aus Schnittstelle kopiert:ContainerCreate a stream of the Payload. This may be suitable, if the payload is a collection. -
streamContained
Beschreibung aus Schnittstelle kopiert:ContainerCreate a stream of the Payload. This may be suitable, if the payload is a collection.- Angegeben von:
streamContainedin SchnittstelleContainer<None>- Typparameter:
Inner- the type of the payloads of the elements of the stream- Gibt zurück:
- a stream of results
-
toString
-
then
map an error to another object- Typparameter:
T- type of the expected result- Parameter:
mapper- the mapper function- Gibt zurück:
- the object returned by the mapper function
-
transform
create an Error with the same metadata content as this Object, but with different payload type- Typparameter:
NewType- the payload type of the returned error- Gibt zurück:
- the transformed Error (new object)
-
wrap
Wrap an error object as Optional- Gibt zurück:
- an Optional carrying this Error object
-