@Experimental(value="Request context to allow downstream operations to get insight into the request. Not covered by the specification. Subject to change.")
public interface Context
Modifier and Type | Interface and Description |
---|---|
static class |
Context.VariablesParser
Help to parse the variables
|
Modifier and Type | Field and Description |
---|---|
static String |
OPERATION_NAME |
static String |
QUERY |
static String |
VARIABLES |
Modifier and Type | Method and Description |
---|---|
<T> T |
getArgument(String name)
Get the argument using a name
This return the argument instance if it exists
|
default <T> T |
getArgumentOrDefault(String name,
T defaultValue)
Same as above but with the option to do a default value
|
Map<String,Object> |
getArguments()
Get all the arguments
|
String |
getExecutionId()
Get the execution ID.
|
String |
getFieldName()
Get the field name
|
default Optional<String> |
getOperationName()
Get the operationName of the request.
|
String |
getOperationType()
Return the current type (Query, Mutation ext)
Current type means the type currently being executed.
|
Optional<String> |
getParentTypeName()
Return the type name of the parent (if any)
|
String |
getPath()
Return the current path
|
default String |
getQuery()
Get the query part of the request.
|
javax.json.JsonObject |
getRequest()
Get the full body of the request.
|
List<String> |
getRequestedOperationTypes()
Return all the operation types requested (unique list)
A Request can contain more than one operation.
|
default javax.json.JsonArray |
getSelectedFields()
Return the fields selected in the request
|
javax.json.JsonArray |
getSelectedFields(boolean includeSourceFields)
Return the fields in the request
|
<T> T |
getSource() |
default Optional<Map<String,Object>> |
getVariables()
Get the variables of the request
Could be null (not set)
|
Boolean |
hasArgument(String name)
Return true if the argument exist
|
default boolean |
hasOperationName()
Check if the request contains an operation name
|
default boolean |
hasSource() |
default boolean |
hasVariables()
Check if the request contains variables
|
<T> T |
unwrap(Class<T> wrappedType)
This leaky abstraction allows falling down to the underlying implementation
|
static final String QUERY
static final String OPERATION_NAME
static final String VARIABLES
javax.json.JsonObject getRequest()
default String getQuery()
default Optional<String> getOperationName()
default boolean hasOperationName()
default Optional<Map<String,Object>> getVariables()
default boolean hasVariables()
String getExecutionId()
String getFieldName()
Boolean hasArgument(String name)
name
- the argument name<T> T getArgument(String name)
default <T> T getArgumentOrDefault(String name, T defaultValue)
T
- name
- defaultValue
- Map<String,Object> getArguments()
default boolean hasSource()
<T> T getSource()
String getPath()
default javax.json.JsonArray getSelectedFields()
javax.json.JsonArray getSelectedFields(boolean includeSourceFields)
includeSourceFields
- should we include source fields ?String getOperationType()
List<String> getRequestedOperationTypes()
Optional<String> getParentTypeName()
<T> T unwrap(Class<T> wrappedType)
T
- the implementation classwrappedType
- the class type of TCopyright © 2018–2021. All rights reserved.