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) Variant oftoEntity(Class)
to decode to a list of entities.<D> List<D>
toEntityList
(ParameterizedTypeReference<D> elementType) Variant oftoEntity(Class)
to decode to a list of entities.Methods inherited from interface org.springframework.graphql.ResponseField
getErrors, getParsedPath, getPath, getValue
-
Method Details
-
toEntity
Decode the field to an entity of the given type.- Type Parameters:
D
- the entity type- Parameters:
entityType
- the type to convert to- Returns:
- the decoded entity, or
null
if the field isnull
but otherwise there are no errors - Throws:
FieldAccessException
- if the target field isnull
and the response is notvalid
or the field haserrors
.
-
toEntity
Variant oftoEntity(Class)
with aParameterizedTypeReference
.- Type Parameters:
D
- the entity type- Parameters:
entityType
- the type to convert to
-
toEntityList
Variant oftoEntity(Class)
to decode to a list of entities.- Type Parameters:
D
- the entity type- Parameters:
elementType
- the type of elements in the list- Returns:
- the list of decoded entities, or an empty list if the field is
null
but otherwise there are no errors - Throws:
FieldAccessException
- if the target field isnull
and the response is notvalid
or the field haserrors
.
-
toEntityList
Variant oftoEntity(Class)
to decode to a list of entities.- Type Parameters:
D
- the entity type- Parameters:
elementType
- the type of elements in the list- Returns:
- the list of decoded entities, or an empty list if the field is
null
but otherwise there are no errors - Throws:
FieldAccessException
- if the target field isnull
and the response is notvalid
or the field haserrors
.
-