Class AbstractResourceBeanMapper

java.lang.Object
org.onehippo.cms7.crisp.api.resource.AbstractResourceBeanMapper
All Implemented Interfaces:
ResourceBeanMapper

public abstract class AbstractResourceBeanMapper extends Object implements ResourceBeanMapper
Abstract implementation for ResourceBeanMapper.
  • Constructor Details

    • AbstractResourceBeanMapper

      public AbstractResourceBeanMapper()
  • Method Details

    • mapCollection

      public <T> Collection<T> mapCollection(ResourceCollection resourceCollection, Class<T> beanType) throws ResourceException
      Description copied from interface: ResourceBeanMapper
      Map the child resources of the ResourceCollection to a new collection of beanType to return.
      Specified by:
      mapCollection in interface ResourceBeanMapper
      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

      public <T> Collection<T> mapCollection(ResourceCollection resourceCollection, Class<T> beanType, int offset, int limit) throws ResourceException
      Description copied from interface: ResourceBeanMapper
      Map the child resources of the ResourceCollection to a new collection of beanType to return.
      Specified by:
      mapCollection in interface ResourceBeanMapper
      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

      public <T> void mapCollection(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection) throws ResourceException
      Description copied from interface: ResourceBeanMapper
      Map the child resources of the ResourceCollection and push them to the given targetBeanCollection of beanType.
      Specified by:
      mapCollection in interface ResourceBeanMapper
      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

      public <T> void mapCollection(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection, int offset, int length) throws ResourceException
      Description copied from interface: ResourceBeanMapper
      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.
      Specified by:
      mapCollection in interface ResourceBeanMapper
      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.
      length - 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