// Path: lambda-local/src/main/java/com/zaoo/lambda/ObjectMappers.java
// public class ObjectMappers {
//     private static ObjectMapper objectMapper;
//     private static ObjectReader objectReader;
//     private static ObjectWriter objectWriter;
// 
//     static {
//         createInstance(ObjectMapper::new);
//     }
// 
//     private static void createInstance(ObjectMapperFactory objectMapperFactory) {
//         objectMapper = objectMapperFactory.createInstance();
//         objectReader = objectMapper.reader();
//         objectWriter = objectMapper.writer();
//     }
// 
//     public static ObjectMapper getObjectMapper() {
//         return objectMapper;
//     }
// 
//     public static ObjectReader getReader() {
//         return objectReader;
//     }
// 
//     public static ObjectWriter getWriter() {
//         return objectWriter;
//     }
// 
//     public static void setObjectMapperFactory(ObjectMapperFactory objectMapperFactory) {
//         createInstance(objectMapperFactory);
//     }
// 
//     private ObjectMappers() {
//     }
// }


import com.fasterxml.jackson.databind.JavaType;
import com.zaoo.lambda.ObjectMappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
package com.zaoo.lambda.rest;



/**
 * Support String, Integer, Long, Float, Double, Boolean, Enum, and JSON (Using jackson)
 */
public class JsonRestParamDeserializer implements RestParamDeserializer<Object> {
    private static final Logger log = LoggerFactory.getLogger(JsonRestParamDeserializer.class);

    @Override
    public Object deserialize(String str, JavaType javaType) {
        if (String.class.isAssignableFrom(javaType.getRawClass())) {
            return str;
        }
        if (Integer.class.isAssignableFrom(javaType.getRawClass()) || int.class.isAssignableFrom(javaType.getRawClass())) {
            return Integer.parseInt(str);
        }
        if (Long.class.isAssignableFrom(javaType.getRawClass()) || long.class.isAssignableFrom(javaType.getRawClass())) {
            return Long.parseLong(str);
        }
        if (Float.class.isAssignableFrom(javaType.getRawClass()) || float.class.isAssignableFrom(javaType.getRawClass())) {
            return Float.parseFloat(str);
        }
        if (Double.class.isAssignableFrom(javaType.getRawClass()) || double.class.isAssignableFrom(javaType.getRawClass())) {
            return Double.parseDouble(str);
        }
        if (Boolean.class.isAssignableFrom(javaType.getRawClass()) || boolean.class.isAssignableFrom(javaType.getRawClass())) {
            return Boolean.parseBoolean(str);
        }
        if (Enum.class.isAssignableFrom(javaType.getRawClass())) {
            Class<?> rawClass = javaType.getRawClass();
            return toEnum(str, rawClass);
        }

        try {
// Path: lambda-local/src/main/java/com/zaoo/lambda/ObjectMappers.java
// public class ObjectMappers {
//     private static ObjectMapper objectMapper;
//     private static ObjectReader objectReader;
//     private static ObjectWriter objectWriter;
// 
//     static {
//         createInstance(ObjectMapper::new);
//     }
// 
//     private static void createInstance(ObjectMapperFactory objectMapperFactory) {
//         objectMapper = objectMapperFactory.createInstance();
//         objectReader = objectMapper.reader();
//         objectWriter = objectMapper.writer();
//     }
// 
//     public static ObjectMapper getObjectMapper() {
//         return objectMapper;
//     }
// 
//     public static ObjectReader getReader() {
//         return objectReader;
//     }
// 
//     public static ObjectWriter getWriter() {
//         return objectWriter;
//     }
// 
//     public static void setObjectMapperFactory(ObjectMapperFactory objectMapperFactory) {
//         createInstance(objectMapperFactory);
//     }
// 
//     private ObjectMappers() {
//     }
// }


// Path: lambda-local/src/main/java/com/zaoo/lambda/rest/JsonRestParamDeserializer.java
import com.fasterxml.jackson.databind.JavaType;
import com.zaoo.lambda.ObjectMappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;

package com.zaoo.lambda.rest;



/**
 * Support String, Integer, Long, Float, Double, Boolean, Enum, and JSON (Using jackson)
 */
public class JsonRestParamDeserializer implements RestParamDeserializer<Object> {
    private static final Logger log = LoggerFactory.getLogger(JsonRestParamDeserializer.class);

    @Override
    public Object deserialize(String str, JavaType javaType) {
        if (String.class.isAssignableFrom(javaType.getRawClass())) {
            return str;
        }
        if (Integer.class.isAssignableFrom(javaType.getRawClass()) || int.class.isAssignableFrom(javaType.getRawClass())) {
            return Integer.parseInt(str);
        }
        if (Long.class.isAssignableFrom(javaType.getRawClass()) || long.class.isAssignableFrom(javaType.getRawClass())) {
            return Long.parseLong(str);
        }
        if (Float.class.isAssignableFrom(javaType.getRawClass()) || float.class.isAssignableFrom(javaType.getRawClass())) {
            return Float.parseFloat(str);
        }
        if (Double.class.isAssignableFrom(javaType.getRawClass()) || double.class.isAssignableFrom(javaType.getRawClass())) {
            return Double.parseDouble(str);
        }
        if (Boolean.class.isAssignableFrom(javaType.getRawClass()) || boolean.class.isAssignableFrom(javaType.getRawClass())) {
            return Boolean.parseBoolean(str);
        }
        if (Enum.class.isAssignableFrom(javaType.getRawClass())) {
            Class<?> rawClass = javaType.getRawClass();
            return toEnum(str, rawClass);
        }

        try {
            return ObjectMappers.getReader().forType(javaType).readValue(str);