Interface ClientResponseField
- All Superinterfaces:
ResponseField
Extends
ResponseField
to add options for decoding the field value.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescription<D> D
Decode the field to an entity of the given type.<D> D
toEntity
(ParameterizedTypeReference<D> entityType) Variant oftoEntity(Class)
with aParameterizedTypeReference
.<D> List<D>
toEntityList
(Class<D> elementType) Decode the field to a list of entities with the given type.<D> List<D>
toEntityList
(ParameterizedTypeReference<D> elementType) Variant oftoEntityList(Class)
withParameterizedTypeReference
.Methods inherited from interface org.springframework.graphql.ResponseField
getError, getErrors, getParsedPath, getPath, getValue, hasValue
-
Method Details
-
toEntity
Decode the field to an entity of the given type.- Parameters:
entityType
- the type to convert to- Returns:
- the decoded entity, never
null
- Throws:
FieldAccessException
- if the target field is not present or has no value, checked viaResponseField.hasValue()
.
-
toEntity
Variant oftoEntity(Class)
with aParameterizedTypeReference
. -
toEntityList
Decode the field to a list of entities with the given type.- Parameters:
elementType
- the type of elements in the list- Returns:
- the decoded list of entities, possibly empty
- Throws:
FieldAccessException
- if the target field is not present or has no value, checked viaResponseField.hasValue()
.
-
toEntityList
Variant oftoEntityList(Class)
withParameterizedTypeReference
.
-