Interface ClientResponseField

All Superinterfaces:
ResponseField

public interface ClientResponseField extends ResponseField
Extends ResponseField to add options for decoding the field value.
Since:
1.0.0
Author:
Rossen Stoyanchev
  • Method Details

    • toEntity

      @Nullable <D> D toEntity(Class<D> entityType)
      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 is null but otherwise there are no errors
      Throws:
      FieldAccessException - if the target field is null and the response is not valid or the field has errors.
    • toEntity

      @Nullable <D> D toEntity(ParameterizedTypeReference<D> entityType)
      Type Parameters:
      D - the entity type
      Parameters:
      entityType - the type to convert to
    • toEntityList

      <D> List<D> toEntityList(Class<D> elementType)
      Variant of toEntity(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 is null and the response is not valid or the field has errors.
    • toEntityList

      <D> List<D> toEntityList(ParameterizedTypeReference<D> elementType)
      Variant of toEntity(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 is null and the response is not valid or the field has errors.