@Produces(value="application/json") @Provider public class EntityJSONCollectionWriter<T> extends EntityJSONWriter<T>
Collection
of Entities As JSON Array
Collection
is expected to have multiple entities then look @ #entityToJsonProvider
and entityJsonTransformersMap
.
In this EntityJSONWriter.getEntityToJSON()
is the default Transformer
if the input doesnt resolve to any in entityJsonTransformersMap
.entityJsonTransformersMap
,
entityToJsonMapper
entityToJSON, type
nullValueSupplier
ct, t
Constructor and Description |
---|
EntityJSONCollectionWriter() |
Modifier and Type | Method and Description |
---|---|
Function<ParameterizedType,Boolean> |
getCollectionTypeEvaluator()
If
ParameterizedType should be isWriteable(Class, Type, Annotation[], MediaType) or not.Function from ParameterizedCollectionType to Boolean |
Map<Class,org.apache.commons.collections.Transformer> |
getEntityJsonTransformersMap()
|
Function<Object,org.apache.commons.collections.Transformer> |
getEntityToJsonMapper()
Function from Object to Transformer . |
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType) |
void |
setCollectionTypeEvaluator(Function<ParameterizedType,Boolean> collectionTypeEvaluator)
If
ParameterizedType should be isWriteable(Class, Type, Annotation[], MediaType) or not.Function from ParameterizedCollectionType to Boolean |
void |
setEntityJsonTransformersMap(Map<Class,org.apache.commons.collections.Transformer> entityJsonTransformersMap)
|
void |
setEntityToJsonMapper(Function<Object,org.apache.commons.collections.Transformer> entityToJsonMapper)
Function from Object to Transformer . |
void |
writeTo(T t,
Class<?> type,
Type genericType,
Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream) |
getConfig, getEntityToJSON, getType, setEntityToJSON, setType
getNullValueSupplier, getSize, setNullValueSupplier
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
isWriteable
in interface javax.ws.rs.ext.MessageBodyWriter<T>
isWriteable
in class EntityJSONWriter<T>
public void writeTo(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException, javax.ws.rs.WebApplicationException
writeTo
in interface javax.ws.rs.ext.MessageBodyWriter<T>
writeTo
in class EntityJSONWriter<T>
IOException
javax.ws.rs.WebApplicationException
public Map<Class,org.apache.commons.collections.Transformer> getEntityJsonTransformersMap()
public void setEntityJsonTransformersMap(Map<Class,org.apache.commons.collections.Transformer> entityJsonTransformersMap)
public Function<ParameterizedType,Boolean> getCollectionTypeEvaluator()
ParameterizedType
should be isWriteable(Class, Type, Annotation[], MediaType)
or not.Function
from ParameterizedCollectionType
to Boolean
entityJsonTransformersMap
public void setCollectionTypeEvaluator(Function<ParameterizedType,Boolean> collectionTypeEvaluator)
ParameterizedType
should be isWriteable(Class, Type, Annotation[], MediaType)
or not.Function
from ParameterizedCollectionType
to Boolean
entityJsonTransformersMap
public Function<Object,org.apache.commons.collections.Transformer> getEntityToJsonMapper()
Function
from Object to Transformer
.entityJsonTransformersMap
EntityJSONWriter.getEntityToJSON()
public void setEntityToJsonMapper(Function<Object,org.apache.commons.collections.Transformer> entityToJsonMapper)
Function
from Object to Transformer
.entityJsonTransformersMap
EntityJSONWriter.getEntityToJSON()
Copyright © 2018. All rights reserved.