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
@Argument
in which case the argument name is determined from the method parameter name, or together with@Argument
to specify the argument name. - As a field within the object structure of an
@Argument
method 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.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the contained value as a nullableOptional
.boolean
int
hashCode()
boolean
Returntrue
if the input value was omitted altogether from the input, andfalse
if it was provided, but possibly set to the "null" literal.boolean
Returntrue
if a non-null value is present, andfalse
otherwise.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()Returntrue
if a non-null value is present, andfalse
otherwise. -
isOmitted
public boolean isOmitted()Returntrue
if the input value was omitted altogether from the input, andfalse
if 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.- Type Parameters:
T
- the type of value- Parameters:
value
- the value to hold in the instance
-
omitted
Static factory method for an argument value that was omitted.- Type Parameters:
T
- the type of value
-