public abstract class PageBuilderUtils extends Object
Utility methods.
| Modifier and Type | Method and Description |
|---|---|
static <E> Page<E> |
cast(Page<?> page)
Casts a page.
|
static <E,T> PageResult<T> |
createPage(Iterable<? extends E> entries,
PageRequest pageRequest,
long totalSize,
PageEntryTransformer<T,E> transformer)
Creates a page.
|
static <E,T> Page<T> |
createPage(Page<? extends E> sourcePage,
PageEntryTransformer<T,E> transformer)
Transforms a page into another page.
|
static <E,T> PageDto |
createPageDto(Page<? extends E> page,
PageEntryTransformer<T,E> transformer)
Transforms a page into a page DTO.
|
static PageRequestDto |
createPageRequestDto(PageRequest pageRequest)
Transforms a page request into a page request DTO.
|
static <T> T |
jsonMapToObject(Map<String,Object> map,
Class<T> valueType,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Transforms a JSON map to an object.
|
static <T,S extends T> |
transform(Object xmlNodeOrJsonMap,
Class<T> valueType,
S defaultObject,
JAXBContext jaxbContext,
com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Transforms a XML node or a JSON map into an object.
|
static <T> T |
xmlNodeToObject(Node node,
Class<T> valueType,
JAXBContext jaxbContext)
Transforms a XML node into an object.
|
public static <E,T> PageResult<T> createPage(Iterable<? extends E> entries, PageRequest pageRequest, long totalSize, PageEntryTransformer<T,E> transformer)
entries - the page entriespageRequest - the page requesttotalSize - the total sizetransformer - the entry transformer (may be null - than all entries
will be added to the page without transforming)public static <E,T> Page<T> createPage(Page<? extends E> sourcePage, PageEntryTransformer<T,E> transformer)
sourcePage - the source pagetransformer - the entry transformer (may be null - than all entries
of the source page will be added to the target page without
transforming)public static <E,T> PageDto createPageDto(Page<? extends E> page, PageEntryTransformer<T,E> transformer)
page - the pagetransformer - the entry transformer (may be null - than all entries
of the page will be added to the DTO without transforming)public static PageRequestDto createPageRequestDto(PageRequest pageRequest)
pageRequest - the page request (can be null)null)public static <T,S extends T> T transform(Object xmlNodeOrJsonMap, Class<T> valueType, S defaultObject, JAXBContext jaxbContext, com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws Exception
xmlNodeOrJsonMap - the XML node or JSON mapvalueType - the class of the target objectdefaultObject - a default object (optional)jaxbContext - the JAXBContext (can be null)objectMapper - the JSON object mapper (optional)Exception - if transformation failspublic static <T> T xmlNodeToObject(Node node, Class<T> valueType, JAXBContext jaxbContext) throws JAXBException
node - the XML nodevalueType - the class of the target objectjaxbContext - the JAXBContext (can be null)JAXBException - if transformation failspublic static <T> T jsonMapToObject(Map<String,Object> map, Class<T> valueType, com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws IOException
map - the JSON mapvalueType - the class of the target objectobjectMapper - the JSON object mapper (optional)IOException - if transformation failsCopyright © 2017 bremersee.org. All rights reserved.