public Builder<T> toBuilder() { return new Builder<T>(operation) .data(data) .errors(errors) .dependentKeys(dependentKeys) .fromCache(fromCache); }
public RealResponseReader(Operation.Variables operationVariables, R recordSet, FieldValueResolver<R> fieldValueResolver, ScalarTypeAdapters scalarTypeAdapters, ResolveDelegate<R> resolveDelegate) { this.operationVariables = operationVariables; this.recordSet = recordSet; this.fieldValueResolver = fieldValueResolver; this.scalarTypeAdapters = scalarTypeAdapters; this.resolveDelegate = resolveDelegate; this.variableValues = operationVariables.valueMap(); }
/** * Creates a new {@link Input} instance that is always undefined. * * @param value to be wrapped * @return a new {@link Input} instance */ public static <V> Input<V> absent() { return new Input<>(null, false); }
static String idForSubscription(Subscription<?, ?, ?> subscription) { return subscription.operationId() + "$" + subscription.variables().valueMap().hashCode(); }
/** * Factory method for creating a Field instance representing a custom {@link Type#OBJECT}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing custom {@link Type#OBJECT} */ public static ResponseField forObject(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.OBJECT, responseName, fieldName, arguments, optional, conditions); }
public Response<T> build() { return new Response<>(this); } }
/** * Factory method for creating a Field instance representing a custom GraphQL Scalar type, {@link Type#CUSTOM} * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param scalarType the custom scalar type of the field * @param conditions list of conditions for this field * @return Field instance representing {@link Type#CUSTOM} */ public static CustomTypeField forCustomType(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, ScalarType scalarType, List<Condition> conditions) { return new CustomTypeField(responseName, fieldName, arguments, optional, scalarType, conditions); }
@Test public void testInputNotEqualsOnDifferentObjects() { TestObject object = new TestObject("Hello world!"); TestObject anotherObject = new TestObject("Bye world!"); Input<TestObject> aInput = Input.fromNullable(object); Input<TestObject> anotherInput = Input.fromNullable(anotherObject); assertNotEquals(aInput, anotherInput); }
@Override public void marshal(InputFieldWriter writer) throws IOException { writer.writeString("someField", "someValue"); } });
/** * Factory method for creating a Field instance representing {@link Type#DOUBLE}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#DOUBLE} */ public static ResponseField forDouble(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.DOUBLE, responseName, fieldName, arguments, optional, conditions); }
@Test public void testInputEqualsOnEqualObjectsWithDifferentReferences() { TestObject object1 = new TestObject("Hello world!"); TestObject object2 = new TestObject("Hello world!"); Input<TestObject> input1 = Input.fromNullable(object1); Input<TestObject> input2 = Input.fromNullable(object2); assertEquals(input1, input2); }
/** * Factory method for creating a Field instance representing {@link Type#ENUM}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#ENUM} */ public static ResponseField forEnum(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.ENUM, responseName, fieldName, arguments, optional, conditions); }
@Test public void testInputNotEqualsWhenAnObjectIsNull() { TestObject object = new TestObject(null); Input<TestObject> aInput = Input.fromNullable(object); Input<TestObject> anotherInput = Input.fromNullable(null); assertNotEquals(aInput, anotherInput); }
/** * Factory method for creating a Field instance representing {@link Type#LIST}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#LIST} */ public static ResponseField forList(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.LIST, responseName, fieldName, arguments, optional, conditions); }
@Test public void testInputEqualsOnObjectsWithNullValue() { TestObject object = new TestObject(null); Input<TestObject> aInput = Input.fromNullable(object); Input<TestObject> anotherInput = Input.fromNullable(object); assertEquals(aInput, anotherInput); }
/** * Factory method for creating a Field instance representing {@link Type#STRING}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#STRING} */ public static ResponseField forString(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.STRING, responseName, fieldName, arguments, optional, conditions); }
/** * Factory method for creating a Field instance representing {@link Type#INT}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#INT} */ public static ResponseField forInt(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.INT, responseName, fieldName, arguments, optional, conditions); }
/** * Factory method for creating a Field instance representing {@link Type#LONG}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#LONG} */ public static ResponseField forLong(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.LONG, responseName, fieldName, arguments, optional, conditions); }
/** * Factory method for creating a Field instance representing {@link Type#BOOLEAN}. * * @param responseName alias for the result of a field * @param fieldName name of the field in the GraphQL operation * @param arguments arguments to be passed along with the field * @param optional whether the arguments passed along are optional or required * @param conditions list of conditions for this field * @return Field instance representing {@link Type#BOOLEAN} */ public static ResponseField forBoolean(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.BOOLEAN, responseName, fieldName, arguments, optional, conditions); }