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.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn the contained value as a nullableOptional.booleaninthashCode()voidIf a value is present, performs the given action with the value, otherwise does nothing.booleanisEmpty()Returntrueif the input value was present in the input but the value wasnull, andfalseotherwise.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(@Nullable 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.toString()@Nullable Tvalue()Return the contained value, ornull.
-
Method Details
-
isPresent
public boolean isPresent()Returntrueif a non-null value is present, andfalseotherwise. -
isEmpty
public boolean isEmpty()Returntrueif the input value was present in the input but the value wasnull, andfalseotherwise.- Since:
- 1.4.0
-
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
-
ifPresent
-
equals
-
hashCode
-
toString
-
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
-