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

org.zodiac.actuate.bootstrap.rule.AppRuleResponse Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.actuate.bootstrap.rule;

import org.zodiac.commons.model.Result;

public class AppRuleResponse extends Result {

    private static final long serialVersionUID = -5609010703655290387L;

    private AppRuleResponse(boolean success, T data, String message) {
        super(success, data, message);
    }

    private AppRuleResponse(boolean success, String message) {
        super(success, message);
    }

    private AppRuleResponse(boolean success, T data) {
        super(success, data);
    }

    private AppRuleResponse(boolean success) {
        super(success);
    }

    @Override
    public String toString() {
        return "AppRuleResponse [getStatusCode()=" + getStatusCode() + ", isSuccess()=" + isSuccess() + ", getData()="
            + getData() + ", getMsg()=" + getMsg() + "]";
    }

    public static  AppRuleResponse successOf(T data, String message) {
        return new AppRuleResponse(true, data, message);
    }

    public static  AppRuleResponse successOfMessage(String message) {
        return new AppRuleResponse(true, message);
    }

    public static  AppRuleResponse successOfData(T data) {
        return new AppRuleResponse(true, data);
    }

    public static  AppRuleResponse failOf(T data, String message) {
        return failOf(data, message, DEFAULT_FAILURE_STATYS_CODE);
    }

    public static  AppRuleResponse failOf(T data, String message, int statusCode) {
        AppRuleResponse res = new AppRuleResponse(false, data, message);
        res.setStatusCode(statusCode);
        return res;
    }

    public static  AppRuleResponse failOfMessage(String message) {
        return failOfMessage(message, DEFAULT_FAILURE_STATYS_CODE);
    }

    public static  AppRuleResponse failOfMessage(String message, int statusCode) {
        AppRuleResponse res = new AppRuleResponse(false, message);
        res.setStatusCode(statusCode);
        return res;
    }

    public static  AppRuleResponse failOfData(T data) {
        return failOfData(data, DEFAULT_FAILURE_STATYS_CODE);
    }

    public static  AppRuleResponse failOfData(T data, int statusCode) {
        AppRuleResponse res = new AppRuleResponse(false, data);
        res.setStatusCode(statusCode);
        return res;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy