Class PartialPreparedRequests
java.lang.Object
com.graphql_java_generator.samples.simple.client.graphql.PartialPreparedRequests
- All Implemented Interfaces:
Queries
This class implements the away to call GraphQl queries, where all queries are prepared before execution.
The advantages are:
The advantages are:
- Performance: this avoid to build an
ObjectResponse
for each response. ThisObjectResponse
is useful, to help control at runtime if a field has been queried or not. It allows to throw an exception when your code tries to use a field that was not queried - Security: as all request have been prepared at startup, this make sure at startup that your queries are valid.
- Author:
- etienne-sf
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateHuman
(String name, String homePlanet) droidPartial
(String id) heroFriendsFriendsFriends
(Episode episode) heroFull()
heroPartial
(Episode episode) humanPartial
(String id) void
init()
This method is executed, once all dependencies have been loaded.
-
Constructor Details
-
PartialPreparedRequests
public PartialPreparedRequests()
-
-
Method Details
-
init
This method is executed, once all dependencies have been loaded. It prepares all the GraphQL requests -
heroFull
- Specified by:
heroFull
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
heroPartial
- Specified by:
heroPartial
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
heroFriendsFriendsFriends
- Specified by:
heroFriendsFriendsFriends
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
humanFull
- Specified by:
humanFull
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
humanPartial
- Specified by:
humanPartial
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
humanFriendsFriendsFriends
- Specified by:
humanFriendsFriendsFriends
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
droidFull
- Specified by:
droidFull
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
droidPartial
- Specified by:
droidPartial
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
droidFriendsFriendsFriends
- Specified by:
droidFriendsFriendsFriends
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
droidDoesNotExist
- Specified by:
droidDoesNotExist
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
-
createHuman
public Human createHuman(String name, String homePlanet) throws GraphQLRequestExecutionException, GraphQLRequestPreparationException - Specified by:
createHuman
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
GraphQLRequestPreparationException
-
addFriend
public Character addFriend(String idCharacter, String idNewFriend) throws GraphQLRequestExecutionException, GraphQLRequestPreparationException - Specified by:
addFriend
in interfaceQueries
- Throws:
GraphQLRequestExecutionException
GraphQLRequestPreparationException
-