All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.nezha.httpfetch.resolver.ParameterUtils Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.github.nezha.httpfetch.resolver;

import com.alibaba.fastjson.JSONObject;
import com.github.nezha.httpfetch.CommonUtils;

/**
 * Created by daiqiang on 17/9/7.
 */
public class ParameterUtils {

    public static String parseParameter(Object value){
        if(value == null){
            return "";
        }
        Class parameterCls = value.getClass();
        if(String.class.isAssignableFrom(parameterCls)){
            return value.toString();
        }else if(CommonUtils.isPrimitive(parameterCls)){
            return String.valueOf(value);
        }else if(parameterCls.isEnum()){
            return value.toString();
        }else {
            return JSONObject.toJSONString(value);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy