java.lang.Object
java.lang.Record
org.bsc.async.AsyncGenerator.Data<E>
- Type Parameters:
E
- the type of the data element
- Enclosing interface:
- AsyncGenerator<E>
public static record AsyncGenerator.Data<E>(CompletableFuture<E> future, AsyncGenerator.Embed<E> embed, Object resultValue)
extends Record
Represents a data element in the AsyncGenerator.
-
Constructor Summary
ConstructorsConstructorDescriptionData
(CompletableFuture<E> future, AsyncGenerator.Embed<E> embed, Object resultValue) Creates an instance of aData
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> AsyncGenerator.Data<E>
composeWith
(AsyncGenerator<E> generator, AsyncGenerator.EmbedCompletionHandler onCompletion) static <E> AsyncGenerator.Data<E>
done()
static <E> AsyncGenerator.Data<E>
embed()
Returns the value of theembed
record component.final boolean
Indicates whether some other object is "equal to" this one.static <E> AsyncGenerator.Data<E>
future()
Returns the value of thefuture
record component.final int
hashCode()
Returns a hash code value for this object.boolean
isDone()
boolean
isError()
static <E> AsyncGenerator.Data<E>
of
(E data) static <E> AsyncGenerator.Data<E>
of
(CompletableFuture<E> future) Returns the value of theresultValue
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Data
Creates an instance of aData
record class.- Parameters:
future
- the value for thefuture
record componentembed
- the value for theembed
record componentresultValue
- the value for theresultValue
record component
-
-
Method Details
-
isDone
public boolean isDone() -
isError
public boolean isError() -
of
-
of
-
composeWith
public static <E> AsyncGenerator.Data<E> composeWith(AsyncGenerator<E> generator, AsyncGenerator.EmbedCompletionHandler onCompletion) -
done
-
done
-
error
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
future
Returns the value of thefuture
record component.- Returns:
- the value of the
future
record component
-
embed
Returns the value of theembed
record component.- Returns:
- the value of the
embed
record component
-
resultValue
Returns the value of theresultValue
record component.- Returns:
- the value of the
resultValue
record component
-