public class Builder extends Object
ObjectResponse, which defines what should appear in the
response from the GraphQL server.| Modifier and Type | Method and Description |
|---|---|
ObjectResponse |
build()
Returns the built
ObjectResponse. |
static String |
getCamelCase(String name)
Convert the given name, to a camel case name.
|
Builder |
withField(String fieldName)
Adds a scalar field with no alias, to the
ObjectResponse we are building |
Builder |
withField(String fieldName,
String alias)
Adds a scalar field with an alias, to the
ObjectResponse we are building |
Builder |
withQueryResponseDef(String queryResponseDef)
Builds a
ObjectResponse from a part of a GraphQL query. |
Builder |
withSubObject(String fieldName,
ObjectResponse objectResponse)
Adds a non scalar field (a subobject) without alias, to the
ObjectResponse we are building |
Builder |
withSubObject(String fieldName,
String fieldAlias,
ObjectResponse subobjetResponseDef)
Adds a scalar field (a subobject) with an alias, to the
ObjectResponse we are building |
public Builder withField(String fieldName) throws GraphQLRequestPreparationException
ObjectResponse we are buildingfieldName - NullPointerException - If the fieldName is nullGraphQLRequestPreparationException - If the fieldName or the fieldAlias is not validpublic Builder withField(String fieldName, String alias) throws GraphQLRequestPreparationException
ObjectResponse we are buildingfieldName - alias - NullPointerException - If the fieldName is nullGraphQLRequestPreparationException - If the fieldName or the fieldAlias is not validpublic Builder withSubObject(String fieldName, ObjectResponse objectResponse) throws GraphQLRequestPreparationException
ObjectResponse we are buildingfieldName - alias - NullPointerException - If the fieldName is nullGraphQLRequestPreparationException - If the fieldName or the fieldAlias is not validpublic Builder withSubObject(String fieldName, String fieldAlias, ObjectResponse subobjetResponseDef) throws GraphQLRequestPreparationException
ObjectResponse we are buildingfieldName - alias - NullPointerException - If the fieldName is nullGraphQLRequestPreparationException - If the fieldName or the fieldAlias is not validpublic ObjectResponse build() throws GraphQLRequestPreparationException
ObjectResponse. If no field (either scalar or suboject) has been added, then all scalar
fields are added.GraphQLRequestPreparationExceptionpublic Builder withQueryResponseDef(String queryResponseDef) throws GraphQLRequestPreparationException
ObjectResponse from a part of a GraphQL query. This part define what's expected as a response
for the field of the current ObjectResponse for this builder.queryResponseDef - A part of a response, for instance (for the hero query of the Star Wars GraphQL schema): "{ id name
friends{name}}"episode - GraphQLRequestPreparationExceptionCopyright © 2019. All rights reserved.