Klasse Payload<Content>

java.lang.Object
de.srsoftware.tools.container.Payload<Content>
Typparameter:
Content - the type of the expected payload
Alle implementierten Schnittstellen:
Container<Content>

public class Payload<Content> extends Object implements Container<Content>
A wrapper for results that carry an actual payload
  • Konstruktordetails

    • Payload

      public Payload(Content object)
      Wrap a payload as a successful instance of Result
      Parameter:
      object - the payload object
  • Methodendetails

    • get

      public Content get()
      get the payload
      Gibt zurück:
      the payload object
    • of

      public static <P> Container<P> of(P object)
      wrap a payload
      Typparameter:
      P - the type of the payload
      Parameter:
      object - the payload to pack
      Gibt zurück:
      the wrapped payload object
    • optional

      public Optional<Content> optional()
      Beschreibung aus Schnittstelle kopiert: Container
      Create an Optional from a Result.
      Angegeben von:
      optional in Schnittstelle Container<Content>
      Gibt zurück:
      An optional containing the Result`s content, if set.
    • stream

      public <Inner> Stream<Inner> stream() throws ClassCastException
      Beschreibung aus Schnittstelle kopiert: Container
      Create a stream of the Payload. This may be suitable, if the payload is a collection.
      Angegeben von:
      stream in Schnittstelle Container<Content>
      Typparameter:
      Inner - the type of the elements of the stream
      Gibt zurück:
      a stream of the contents items.
      Löst aus:
      ClassCastException
    • streamContained

      public <Inner> Stream<Container<Inner>> streamContained()
      Beschreibung aus Schnittstelle kopiert: Container
      Create a stream of the Payload. This may be suitable, if the payload is a collection.
      Angegeben von:
      streamContained in Schnittstelle Container<Content>
      Typparameter:
      Inner - the type of the payloads of the elements of the stream
      Gibt zurück:
      a stream of results
    • then

      public <T> T then(Function<Payload<Content>,T> mapper)
      map a payload 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
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object