com.supermap.services.rest.decoders
Class FastJsonDecoder
- java.lang.Object
-
- com.supermap.services.rest.decoders.Decoder
-
- com.supermap.services.rest.decoders.FastJsonDecoder
-
- All Implemented Interfaces:
- javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
@Provider public class FastJsonDecoder extends Decoder implements javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
FastJson Decoder
-
-
Constructor Summary
Constructors Constructor and Description FastJsonDecoder()
-
Method Summary
Methods Modifier and Type Method and Description protected java.util.List<org.restlet.data.MediaType>createSupportedMediaTypes()${services_rest_decoders_Decoder_method_createSupportedMediaTypes_Title}booleanisReadable(java.lang.Class<?> arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3)java.lang.ObjectreadFrom(java.lang.Class<java.lang.Object> arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> arg4, java.io.InputStream arg5)<T> java.util.List<T>toList(java.lang.String fastjson, java.lang.Class<T> elementClass)Converts the parameter string to a java.util.List object of the specified element type.java.util.Map<java.lang.String,java.lang.Object>toMap(java.lang.String fastjson, java.util.Map<java.lang.String,java.lang.Class> nameClassMapping)Converts the parameter string to the specified type of java.util.Map mapping set.<T> TtoObject(java.lang.String fastjson, java.lang.Class<T> type)Converts a parameter string to a specified type of Java object.java.util.SettoSet(java.lang.String fastjson, java.lang.Class elementClass)Converts the parameter string to a java.util.Set object of the specified element type.-
Methods inherited from class com.supermap.services.rest.decoders.Decoder
getSupportedMediaTypes, isDecoderAllow
-
-
-
-
Method Detail
-
isReadable
public boolean isReadable(java.lang.Class<?> arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3)- Specified by:
isReadablein interfacejavax.ws.rs.ext.MessageBodyReader<java.lang.Object>
-
readFrom
public java.lang.Object readFrom(java.lang.Class<java.lang.Object> arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> arg4, java.io.InputStream arg5) throws java.io.IOException, javax.ws.rs.WebApplicationException- Specified by:
readFromin interfacejavax.ws.rs.ext.MessageBodyReader<java.lang.Object>- Throws:
java.io.IOExceptionjavax.ws.rs.WebApplicationException
-
toObject
public <T> T toObject(java.lang.String fastjson, java.lang.Class<T> type) throws java.lang.ExceptionDescription copied from class:DecoderConverts a parameter string to a specified type of Java object.
${services_rest_decoders_Decoder_method_toObject_Description}
- Specified by:
toObjectin classDecoder- Parameters:
fastjson- ${services_rest_decoders_Decoder_method_toObject_param_jsonStr}type- ${services_rest_decoders_Decoder_method_toObject_param_cl}- Returns:
- ${services_rest_decoders_Decoder_method_toObject_return}
- Throws:
java.lang.Exception- ${services_rest_decoders_Decoder_method_toObject_throws_Exception}
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap(java.lang.String fastjson, java.util.Map<java.lang.String,java.lang.Class> nameClassMapping)Description copied from class:DecoderConverts the parameter string to the specified type of java.util.Map mapping set.
${services_rest_decoders_Decoder_method_toMap_Description}
- Specified by:
toMapin classDecoder- Parameters:
fastjson- wants to convert the parameter string.nameClassMapping- java.util.Map Mapping set. Where the key is the field name and the value is the type of the field.- Returns:
- java.util.Map Parameter mapping set. Where the key is the field name and the value is the corresponding Java object.
-
toList
public <T> java.util.List<T> toList(java.lang.String fastjson, java.lang.Class<T> elementClass) throws java.lang.ExceptionDescription copied from class:DecoderConverts the parameter string to a java.util.List object of the specified element type.- Specified by:
toListin classDecoder- Parameters:
fastjson- wants to convert the parameter string.elementClass- List specifies target element type.- Returns:
- java.util.List A list of parameters.
- Throws:
java.lang.Exception- An error has occurred in the decoding process, throwing a java.lang.Exception exception. For example, if the incoming string is not enough to build a Java object, or if the request is not met, an exception is thrown.
-
toSet
public java.util.Set toSet(java.lang.String fastjson, java.lang.Class elementClass) throws java.lang.ExceptionDescription copied from class:DecoderConverts the parameter string to a java.util.Set object of the specified element type.- Specified by:
toSetin classDecoder- Parameters:
fastjson- wants to convert the parameter string.elementClass- Set specifies target element type.- Returns:
- java.util.Set type of parameter collection.
- Throws:
java.lang.Exception- An error has occurred in the decoding process, throwing a java.lang.Exception exception. For example, if the incoming string is not enough to build a Java object, or if the request is not met, an exception is thrown.
-
createSupportedMediaTypes
protected java.util.List<org.restlet.data.MediaType> createSupportedMediaTypes()
Description copied from class:Decoder${services_rest_decoders_Decoder_method_createSupportedMediaTypes_Title}
${services_rest_decoders_Decoder_method_createSupportedMediaTypes_Description}
- Specified by:
createSupportedMediaTypesin classDecoder- Returns:
- ${services_rest_decoders_Decoder_method_createSupportedMediaTypes_return}
-
-