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

top.rwocj.wx.pay.common.ValidateResult Maven / Gradle / Ivy

There is a newer version: 0.13-javax
Show newest version
package top.rwocj.wx.pay.common;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class ValidateResult {

    private final static ObjectMapper mapper = new ObjectMapper();

    @JsonProperty(index = 1)
    private final String object;
    @JsonProperty(index = 2)
    private final String field;
    @JsonProperty(index = 3)
    private final String message;
    @JsonProperty(index = 4)
    private final Object rejectedValue;

    public ValidateResult(String object, String field, String message, Object rejectedValue) {
        this.object = object;
        this.field = field;
        this.message = message;
        this.rejectedValue = rejectedValue;
    }

    @Override
    public String toString() {
        try {
            return mapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            return "";
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy