Interface ResourceBeanMapper
- All Known Implementing Classes:
AbstractResourceBeanMapper
public interface ResourceBeanMapper
Mapper to convert a
Resource
object to a bean.-
Method Summary
Modifier and TypeMethodDescription<T> T
Map aResource
object to a bean oftype
.<T> Collection<T>
mapCollection
(ResourceCollection resourceCollection, Class<T> beanType) Map the child resources of theResourceCollection
to a new collection ofbeanType
to return.<T> Collection<T>
mapCollection
(ResourceCollection resourceCollection, Class<T> beanType, int offset, int limit) Map the child resources of theResourceCollection
to a new collection ofbeanType
to return.<T> void
mapCollection
(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection) Map the child resources of theResourceCollection
and push them to the giventargetBeanCollection
ofbeanType
.<T> void
mapCollection
(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection, int offset, int limit) Map the child resources of theResourceCollection
and push them to the giventargetBeanCollection
ofbeanType
from theoffset
index up tolimit
size at max.
-
Method Details
-
map
Map aResource
object to a bean oftype
.- Parameters:
resource
- aResource
object to convertbeanType
- type of bean to which theResource
should be mapped- Returns:
- a
Resource
object to a bean oftype
- Throws:
ResourceException
- if theresource
cannot be mapped to thebeanType
-
mapCollection
<T> Collection<T> mapCollection(ResourceCollection resourceCollection, Class<T> beanType) throws ResourceException Map the child resources of theResourceCollection
to a new collection ofbeanType
to return.- Parameters:
resourceCollection
- aResourceCollection
objectbeanType
- type of bean to which theResource
should be mapped- Returns:
- a new collection of beans converted from the child resources of the
resourceCollection
- Throws:
ResourceException
- if aresource
cannot be mapped to thebeanType
-
mapCollection
<T> Collection<T> mapCollection(ResourceCollection resourceCollection, Class<T> beanType, int offset, int limit) throws ResourceException Map the child resources of theResourceCollection
to a new collection ofbeanType
to return.- Parameters:
resourceCollection
- aResourceCollection
objectbeanType
- type of bean to which theResource
should be mappedoffset
- start index ofresourceCollection
to convert from. If offset is a negative value, it's ignored, meaning zero index being effective.limit
- max size ofresourceCollection
to convert fromoffset
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 aresource
cannot be mapped to thebeanType
-
mapCollection
<T> void mapCollection(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection) throws ResourceException Map the child resources of theResourceCollection
and push them to the giventargetBeanCollection
ofbeanType
.- Parameters:
resourceCollection
- aResourceCollection
objectbeanType
- type of bean to which theResource
should be mappedtargetBeanCollection
- target collection of beans converted from the child resources of theresourceCollection
.- Throws:
ResourceException
- if aresource
cannot be mapped to thebeanType
-
mapCollection
<T> void mapCollection(ResourceCollection resourceCollection, Class<T> beanType, Collection<T> targetBeanCollection, int offset, int limit) throws ResourceException Map the child resources of theResourceCollection
and push them to the giventargetBeanCollection
ofbeanType
from theoffset
index up tolimit
size at max.- Parameters:
resourceCollection
- aResourceCollection
objectbeanType
- type of bean to which theResource
should be mappedtargetBeanCollection
- target collection of beans converted from the child resources of theresourceCollection
.offset
- start index ofresourceCollection
to convert from. If offset is a negative value, it's ignored, meaning zero index being effective.limit
- max size ofresourceCollection
to convert fromoffset
index. If limit is a negative value, it's ignored, meaning no limit being applied.- Throws:
ResourceException
- if aresource
cannot be mapped to thebeanType
-