Package org.springframework.graphql.data
Class ArgumentValue<T>
java.lang.Object
org.springframework.graphql.data.ArgumentValue<T>
- Type Parameters:
T- the type of value contained
Simple container for the value from binding a GraphQL argument to a higher
level Object, along with a flag to indicate whether the input argument was
omitted altogether, as opposed to provided but set to the "null"
literal.
Supported in one of the following places:
- On a controller method parameter, either instead of
@Argumentin which case the argument name is determined from the method parameter name, or together with@Argumentto specify the argument name. - As a field within the object structure of an
@Argumentmethod parameter, either initialized via a constructor argument or a setter, including as a field of an object nested at any level below the top level object.
- Since:
- 1.1
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the contained value as a nullableOptional.booleaninthashCode()booleanReturntrueif the input value was omitted altogether from the input, andfalseif it was provided, but possibly set to the "null" literal.booleanReturntrueif a non-null value is present, andfalseotherwise.static <T> ArgumentValue<T>ofNullable(T value) Static factory method for an argument value that was provided, even if it was set to "null.static <T> ArgumentValue<T>omitted()Static factory method for an argument value that was omitted.value()Return the contained value, ornull.
-
Method Details
-
isPresent
public boolean isPresent()Returntrueif a non-null value is present, andfalseotherwise. -
isOmitted
public boolean isOmitted()Returntrueif the input value was omitted altogether from the input, andfalseif it was provided, but possibly set to the "null" literal. -
value
Return the contained value, ornull. -
asOptional
Return the contained value as a nullableOptional. -
equals
-
hashCode
public int hashCode() -
ofNullable
Static factory method for an argument value that was provided, even if it was set to "null.- Parameters:
value- the value to hold in the instance
-
omitted
Static factory method for an argument value that was omitted.
-