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

com.github.xiaobingzhou.messageframe.bind.impl.BodyJsonBindParam Maven / Gradle / Ivy

package com.github.xiaobingzhou.messageframe.bind.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.xiaobingzhou.messageframe.mapper.Mapper;
import com.github.xiaobingzhou.messageframe.request.HandlerRequest;
import com.github.xiaobingzhou.messageframe.enums.ParameterNameEnum;
import com.github.xiaobingzhou.messageframe.bind.BindParam;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BodyJsonBindParam implements BindParam {

    @Override
    public boolean support(String parameterName) {
        return ParameterNameEnum.BODY_JSON.getName().equals(parameterName);
    }

    @Override
    public JSONObject bind(HandlerRequest request) {
        // 按需解码,如果方法上没有request和bodyJson参数就不执行解码操作
        return Mapper.mapper(request);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy