Package graphql.execution
Class FieldValueInfo
- java.lang.Object
-
- graphql.execution.FieldValueInfo
-
@PublicApi public class FieldValueInfo extends java.lang.Object
TheFieldValueInfoholds the type of field that was fetched and completed along with the completed value.A field value is considered when its is both fetch via a
DataFetcherto a raw value, and then it is serialized into scalar or enum or if it's an object type, it is completed as an object given its field sub selectionThe
getFieldValueObject()method returns either a materialized value or aCompletableFuturepromise to a materialized value. Simple in-memory values will tend to be materialized, while complicated values might need a call to a database or other systems will tend to beCompletableFuturepromises.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFieldValueInfo.CompleteValueType
-
Constructor Summary
Constructors Constructor Description FieldValueInfo(FieldValueInfo.CompleteValueType completeValueType, java.lang.Object fieldValueObject)FieldValueInfo(FieldValueInfo.CompleteValueType completeValueType, java.lang.Object fieldValueObject, java.util.List<FieldValueInfo> fieldValueInfos)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FieldValueInfo.CompleteValueTypegetCompleteValueType()This is an enum that represents the type of field value that was completed for a fieldjava.util.concurrent.CompletableFuture<ExecutionResult>getFieldValue()Deprecated.java.util.concurrent.CompletableFuture<java.lang.Object>getFieldValueFuture()This returns the value inCompletableFutureform.java.util.List<FieldValueInfo>getFieldValueInfos()When thegetCompleteValueType()isFieldValueInfo.CompleteValueType.LISTthis holds the list of completed values inside that list object.java.lang.ObjectgetFieldValueObject()This value can be either an object that is materialized or aCompletableFuturepromise to a valuebooleanisFutureValue()java.lang.StringtoString()
-
-
-
Constructor Detail
-
FieldValueInfo
public FieldValueInfo(FieldValueInfo.CompleteValueType completeValueType, java.lang.Object fieldValueObject)
-
FieldValueInfo
public FieldValueInfo(FieldValueInfo.CompleteValueType completeValueType, java.lang.Object fieldValueObject, java.util.List<FieldValueInfo> fieldValueInfos)
-
-
Method Detail
-
getCompleteValueType
public FieldValueInfo.CompleteValueType getCompleteValueType()
This is an enum that represents the type of field value that was completed for a field- Returns:
- the type of field value
-
getFieldValueObject
public java.lang.Object getFieldValueObject()
This value can be either an object that is materialized or aCompletableFuturepromise to a value- Returns:
- either an object that is materialized or a
CompletableFuturepromise to a value
-
getFieldValueFuture
public java.util.concurrent.CompletableFuture<java.lang.Object> getFieldValueFuture()
This returns the value inCompletableFutureform. If it is already aCompletableFutureit is returned directly, otherwise the materialized value is wrapped in aCompletableFutureand returned- Returns:
- a
CompletableFuturepromise to the value
-
getFieldValue
@Deprecated(since="2023-09-11") public java.util.concurrent.CompletableFuture<ExecutionResult> getFieldValue()
Deprecated.Kept for legacy reasons - this method is no longer sensible and is no longer used by the graphql-java engine and is kept only for backwards compatible API reasons.- Returns:
- a promise to the
ExecutionResultthat wraps the field value.
-
isFutureValue
public boolean isFutureValue()
- Returns:
- true if the value is a
CompletableFuturepromise to a value
-
getFieldValueInfos
public java.util.List<FieldValueInfo> getFieldValueInfos()
When thegetCompleteValueType()isFieldValueInfo.CompleteValueType.LISTthis holds the list of completed values inside that list object.- Returns:
- the list of completed field values inside a list
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-