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> DDecode the field to an entity of the given type.<D> DtoEntity(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
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, or
nullif the field isnullbut otherwise there are no errors - Throws:
FieldAccessException- if the target field isnulland the response is notvalidor the field haserrors.
-
toEntity
Variant oftoEntity(Class)with aParameterizedTypeReference. -
toEntityList
Variant oftoEntity(Class)to decode to a list of entities.- Parameters:
elementType- the type of elements in the list- Returns:
- the list of decoded entities, or an empty list if the field is
nullbut otherwise there are no errors - Throws:
FieldAccessException- if the target field isnulland the response is notvalidor the field haserrors.
-
toEntityList
Variant oftoEntity(Class)to decode to a list of entities.- Parameters:
elementType- the type of elements in the list- Returns:
- the list of decoded entities, or an empty list if the field is
nullbut otherwise there are no errors - Throws:
FieldAccessException- if the target field isnulland the response is notvalidor the field haserrors.
-