com.supermap.services.rest.decoders

Class 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}
      boolean isReadable(java.lang.Class<?> arg0, java.lang.reflect.Type arg1, java.lang.annotation.Annotation[] arg2, javax.ws.rs.core.MediaType arg3) 
      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) 
      <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> T toObject(java.lang.String fastjson, java.lang.Class<T> type)
      Converts a parameter string to a specified type of Java object.
      java.util.Set toSet(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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FastJsonDecoder

        public FastJsonDecoder()
        
    • 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:
        isReadable in interface javax.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:
        readFrom in interface javax.ws.rs.ext.MessageBodyReader<java.lang.Object>
        Throws:
        java.io.IOException
        javax.ws.rs.WebApplicationException
      • toObject

        public <T> T toObject(java.lang.String fastjson,
                     java.lang.Class<T> type)
                   throws java.lang.Exception
        
        Description copied from class: Decoder

        Converts a parameter string to a specified type of Java object.

        ${services_rest_decoders_Decoder_method_toObject_Description}

        Specified by:
        toObject in class Decoder
        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: Decoder

        Converts the parameter string to the specified type of java.util.Map mapping set.

        ${services_rest_decoders_Decoder_method_toMap_Description}

        Specified by:
        toMap in class Decoder
        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.Exception
        
        Description copied from class: Decoder
        Converts the parameter string to a java.util.List object of the specified element type.
        Specified by:
        toList in class Decoder
        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.Exception
        
        Description copied from class: Decoder
        Converts the parameter string to a java.util.Set object of the specified element type.
        Specified by:
        toSet in class Decoder
        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:
        createSupportedMediaTypes in class Decoder
        Returns:
        ${services_rest_decoders_Decoder_method_createSupportedMediaTypes_return}