Interface ResourceBeanMapper

All Known Implementing Classes:
AbstractResourceBeanMapper

public interface ResourceBeanMapper
Mapper to convert a Resource object to a bean.
  • Method Details

    • map

      <T> T map(Resource resource, Class<T> beanType) throws ResourceException
      Map a Resource object to a bean of type.
      Parameters:
      resource - a Resource object to convert
      beanType - type of bean to which the Resource should be mapped
      Returns:
      a Resource object to a bean of type
      Throws:
      ResourceException - if the resource cannot be mapped to the beanType
    • mapCollection

      <T> Collection<T> mapCollection(ResourceCollection resourceCollection, Class<T> beanType) throws ResourceException
      Map the child resources of the ResourceCollection to a new collection of beanType to return.
      Parameters:
      resourceCollection - a ResourceCollection object
      beanType - type of bean to which the Resource should be mapped
      Returns:
      a new collection of beans converted from the child resources of the resourceCollection
      Throws:
      ResourceException - if a resource cannot be mapped to the beanType
    • mapCollection

      <T> Collection<T> mapCollection(ResourceCollection resourceCollection, Class<T> beanType, int offset, int limit) throws ResourceException
      Map the child resources of the ResourceCollection to a new collection of beanType to return.
      Parameters:
      resourceCollection - a ResourceCollection object
      beanType - type of bean to which the Resource should be mapped
      offset - start index of resourceCollection to convert from. If offset is a negative value, it's ignored, meaning zero index being effective.
      limit - max size of resourceCollection to convert from offset index. If limit is a negative value, it's ignored, meaning no limit being applied.
      Returns:
      a new collection of beans converted from the child resources of the resourceCollection
      Throws:
      ResourceException - if a resource cannot be mapped to the beanType
    • mapCollection

      <T> void mapCollection(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection) throws ResourceException
      Map the child resources of the ResourceCollection and push them to the given targetBeanCollection of beanType.
      Parameters:
      resourceCollection - a ResourceCollection object
      beanType - type of bean to which the Resource should be mapped
      targetBeanCollection - target collection of beans converted from the child resources of the resourceCollection.
      Throws:
      ResourceException - if a resource cannot be mapped to the beanType
    • mapCollection

      <T> void mapCollection(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection, int offset, int limit) throws ResourceException
      Map the child resources of the ResourceCollection and push them to the given targetBeanCollection of beanType from the offset index up to limit size at max.
      Parameters:
      resourceCollection - a ResourceCollection object
      beanType - type of bean to which the Resource should be mapped
      targetBeanCollection - target collection of beans converted from the child resources of the resourceCollection.
      offset - start index of resourceCollection to convert from. If offset is a negative value, it's ignored, meaning zero index being effective.
      limit - max size of resourceCollection to convert from offset index. If limit is a negative value, it's ignored, meaning no limit being applied.
      Throws:
      ResourceException - if a resource cannot be mapped to the beanType