public class FastJsonProvider extends Object
MessageBodyReader,
MessageBodyWriter| Modifier and Type | Field and Description |
|---|---|
protected Charset |
charset
Deprecated.
|
protected String |
dateFormat
Deprecated.
|
static Class<?>[] |
DEFAULT_UNREADABLES
These are classes that we never use for reading
(never try to deserialize instances of these types).
|
static Class<?>[] |
DEFAULT_UNWRITABLES
These are classes that we never use for writing
(never try to serialize instances of these types).
|
protected SerializerFeature[] |
features
Deprecated.
|
protected SerializeFilter[] |
filters
Deprecated.
|
protected Providers |
providers
Injectable context object used to locate configured
instance of
FastJsonConfig to use for actual
serialization. |
| Constructor and Description |
|---|
FastJsonProvider()
Can serialize/deserialize all types.
|
FastJsonProvider(Class<?>[] clazzes)
Only serialize/deserialize all types in clazzes.
|
FastJsonProvider(String charset)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
Charset |
getCharset()
Deprecated.
|
String |
getDateFormat()
Deprecated.
|
FastJsonConfig |
getFastJsonConfig() |
SerializerFeature[] |
getFeatures()
Deprecated.
|
SerializeFilter[] |
getFilters()
Deprecated.
|
long |
getSize(Object t,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Method that JAX-RS container calls to try to figure out serialized length
of given value. always return -1 to denote "not known".
|
protected boolean |
hasMatchingMediaType(MediaType mediaType)
Check media type like "application/json".
|
protected boolean |
isAssignableFrom(Class<?> type,
Class<?>[] classes)
Check some are interface/abstract classes to exclude.
|
boolean |
isReadable(Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Method that JAX-RS container calls to try to check whether values of
given type (and media type) can be deserialized by this provider.
|
protected boolean |
isValidType(Class<?> type,
Annotation[] classAnnotations)
Check whether a class can be serialized or deserialized.
|
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Method that JAX-RS container calls to try to check whether given value
(of specified type) can be serialized by this provider.
|
protected FastJsonConfig |
locateConfigProvider(Class<?> type,
MediaType mediaType)
Helper method that is called if no config has been explicitly configured.
|
Object |
readFrom(Class<Object> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
<any> httpHeaders,
InputStream entityStream)
Method that JAX-RS container calls to deserialize given value.
|
void |
setCharset(Charset charset)
Deprecated.
|
void |
setDateFormat(String dateFormat)
Deprecated.
|
void |
setFastJsonConfig(FastJsonConfig fastJsonConfig) |
void |
setFeatures(SerializerFeature... features)
Deprecated.
|
void |
setFilters(SerializeFilter... filters)
Deprecated.
|
FastJsonProvider |
setPretty(boolean p)
Set pretty format
|
void |
writeTo(Object obj,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
<any> httpHeaders,
OutputStream entityStream)
Method that JAX-RS container calls to serialize given value.
|
public static final Class<?>[] DEFAULT_UNREADABLES
public static final Class<?>[] DEFAULT_UNWRITABLES
@Deprecated protected Charset charset
@Deprecated protected SerializerFeature[] features
@Deprecated protected SerializeFilter[] filters
@Deprecated protected String dateFormat
protected Providers providers
FastJsonConfig to use for actual
serialization.public FastJsonProvider()
public FastJsonProvider(Class<?>[] clazzes)
@Deprecated public FastJsonProvider(String charset)
charset - the charsetFastJsonConfig.setCharset(Charset)public FastJsonConfig getFastJsonConfig()
public void setFastJsonConfig(FastJsonConfig fastJsonConfig)
fastJsonConfig - the fastJsonConfig to set.public FastJsonProvider setPretty(boolean p)
@Deprecated public Charset getCharset()
FastJsonConfig.getCharset()@Deprecated public void setCharset(Charset charset)
charset - the charsetFastJsonConfig.setCharset(Charset)@Deprecated public String getDateFormat()
FastJsonConfig.getDateFormat()@Deprecated public void setDateFormat(String dateFormat)
dateFormat - the date formatFastJsonConfig.setDateFormat(String)@Deprecated public SerializerFeature[] getFeatures()
FastJsonConfig.getFeatures()@Deprecated public void setFeatures(SerializerFeature... features)
features - the featuresFastJsonConfig.setFeatures(Feature...)@Deprecated public SerializeFilter[] getFilters()
FastJsonConfig.getSerializeFilters()@Deprecated public void setFilters(SerializeFilter... filters)
filters - the filtersFastJsonConfig.setSerializeFilters(SerializeFilter...)protected boolean isAssignableFrom(Class<?> type, Class<?>[] classes)
type - the typeclasses - the classesprotected boolean isValidType(Class<?> type, Annotation[] classAnnotations)
type - class need to checkprotected boolean hasMatchingMediaType(MediaType mediaType)
mediaType - media typepublic boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
public long getSize(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
public void writeTo(Object obj, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, <any> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException
IOExceptionWebApplicationExceptionpublic boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, <any> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
IOExceptionWebApplicationExceptionprotected FastJsonConfig locateConfigProvider(Class<?> type, MediaType mediaType)
Copyright © 2023. All rights reserved.