public class Field
extends java.lang.Object
{
hero {
name
}
}
Field can refer to: GraphQL Scalar Types, Objects or List. For a complete list of types that a Field
object can refer to see Field.Type class.| Modifier and Type | Class and Description |
|---|---|
static class |
Field.ConditionalTypeField
Abstraction for a Field representing a conditional type.
|
static interface |
Field.ConditionalTypeReader<T> |
static class |
Field.CustomTypeField
Abstraction for a Field representing a custom GraphQL scalar type.
|
static interface |
Field.ListItemReader |
static interface |
Field.ListReader<T> |
static class |
Field.ObjectField
Abstraction for a Field representing a custom Object type.
|
static class |
Field.ObjectListField
Abstraction for a Field representing a list of custom Objects.
|
static interface |
Field.ObjectReader<T> |
static class |
Field.ScalarListField
Abstraction for a Field representing a list of GraphQL scalar types.
|
static class |
Field.Type
An abstraction for the field types
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.Object> |
arguments() |
java.lang.String |
cacheKey(Operation.Variables variables) |
java.lang.String |
fieldName() |
static Field |
forBoolean(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional)
Factory method for creating a Field instance representing
Field.Type.BOOLEAN. |
static <T> Field |
forConditionalType(java.lang.String responseName,
java.lang.String fieldName,
Field.ConditionalTypeReader<T> conditionalTypeReader)
Factory method for creating a Field instance representing
Field.Type.CONDITIONAL. |
static Field |
forCustomType(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional,
ScalarType scalarType)
Factory method for creating a Field instance representing a custom GraphQL Scalar type,
Field.Type.CUSTOM |
static Field |
forDouble(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional)
Factory method for creating a Field instance representing
Field.Type.DOUBLE. |
static Field |
forInt(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional)
Factory method for creating a Field instance representing
Field.Type.INT. |
static <T> Field |
forList(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional,
Field.ListReader<T> listReader)
Factory method for creating a Field instance representing
Field.Type.SCALAR_LIST. |
static <T> Field |
forList(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional,
Field.ObjectReader<T> objectReader)
Factory method for creating a Field instance representing
Field.Type.OBJECT_LIST. |
static Field |
forLong(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional)
Factory method for creating a Field instance representing
Field.Type.LONG. |
static <T> Field |
forObject(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional,
Field.ObjectReader<T> objectReader)
Factory method for creating a Field instance representing a custom
Field.Type.OBJECT. |
static Field |
forString(java.lang.String responseName,
java.lang.String fieldName,
java.util.Map<java.lang.String,java.lang.Object> arguments,
boolean optional)
Factory method for creating a Field instance representing
Field.Type.STRING. |
boolean |
optional() |
java.lang.Object |
resolveArgument(java.lang.String name,
Operation.Variables variables)
Resolve field argument value by name.
|
java.lang.String |
responseName() |
Field.Type |
type() |
public static Field forString(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional)
Field.Type.STRING.responseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredField.Type.STRINGpublic static Field forInt(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional)
Field.Type.INT.responseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredField.Type.INTpublic static Field forLong(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional)
Field.Type.LONG.responseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredField.Type.LONGpublic static Field forDouble(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional)
Field.Type.DOUBLE.responseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredField.Type.DOUBLEpublic static Field forBoolean(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional)
Field.Type.BOOLEAN.responseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredField.Type.BOOLEANpublic static <T> Field forObject(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional, Field.ObjectReader<T> objectReader)
Field.Type.OBJECT.T - type of the custom objectresponseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredobjectReader - converts the field response to the custom object typeField.Type.OBJECTpublic static <T> Field forList(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional, Field.ListReader<T> listReader)
Field.Type.SCALAR_LIST.T - type of the scalar typeresponseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredlistReader - converts the field response to a list of GraphQL scalar typesField.Type.SCALAR_LISTpublic static <T> Field forList(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional, Field.ObjectReader<T> objectReader)
Field.Type.OBJECT_LIST.T - type of the custom objectresponseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredobjectReader - converts the field response to a list of custom object typesField.Type.OBJECT_LISTpublic static Field forCustomType(java.lang.String responseName, java.lang.String fieldName, java.util.Map<java.lang.String,java.lang.Object> arguments, boolean optional, ScalarType scalarType)
Field.Type.CUSTOMresponseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationarguments - arguments to be passed along with the fieldoptional - whether the arguments passed along are optional or requiredscalarType - the custom scalar type of the fieldField.Type.CUSTOMpublic static <T> Field forConditionalType(java.lang.String responseName, java.lang.String fieldName, Field.ConditionalTypeReader<T> conditionalTypeReader)
Field.Type.CONDITIONAL.T - type of the conditionalresponseName - alias for the result of a fieldfieldName - name of the field in the GraphQL operationconditionalTypeReader - converts the field response to an optional typeField.Type.CONDITIONALpublic Field.Type type()
public java.lang.String responseName()
public java.lang.String fieldName()
public java.util.Map<java.lang.String,java.lang.Object> arguments()
public boolean optional()
public java.lang.String cacheKey(Operation.Variables variables)
@Nullable
public java.lang.Object resolveArgument(@Nonnull
java.lang.String name,
@Nonnull
Operation.Variables variables)
name - argument namevariables - values of operation variables