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

org.zodiac.actuate.bootstrap.discovery.routing.AppRoutingResponse Maven / Gradle / Ivy

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

import java.util.List;
import java.util.Objects;

import org.zodiac.commons.model.Result;
import org.zodiac.core.bootstrap.breaker.routing.AppRouting;

public class AppRoutingResponse extends Result> {

    private static final long serialVersionUID = -4854223905132586775L;

    public static final AppRoutingResponse EMPTY_SUCESS = new AppRoutingResponse(true, null, null);
    public static final AppRoutingResponse EMPTY_FAIL = new AppRoutingResponse(false, null, null);

    private long lastModify;

    private boolean enabled;

    private AppRoutingResponse(boolean success, List data, String message) {
        super(success, data, message);
    }

    private AppRoutingResponse(boolean success, List data, long lastModify, boolean enabled) {
        super(success, data);
        this.setLastModify(lastModify).setEnabled(enabled);
    }

    private AppRoutingResponse(boolean success, List data, long lastModify) {
        super(success, data);
        this.setLastModify(lastModify);
    }

    private AppRoutingResponse(boolean success, List data, String message, long lastModify,
        boolean enabled) {
        super(success, data, message);
        this.setLastModify(lastModify).setEnabled(enabled);
    }

    private AppRoutingResponse(boolean success, List data, String message, long lastModify) {
        super(success, data, message);
        this.setLastModify(lastModify);
    }

    private AppRoutingResponse(boolean success, String message, long lastModify, boolean enabled) {
        super(success, message);
        this.setLastModify(lastModify).setEnabled(enabled);
    }

    private AppRoutingResponse(boolean success, String message, long lastModify) {
        super(success, message);
        this.setLastModify(lastModify);
    }

    private AppRoutingResponse(boolean success, long lastModify, boolean enabled) {
        super(success);
        this.setLastModify(lastModify).setEnabled(enabled);
    }

    private AppRoutingResponse(boolean success, long lastModify) {
        super(success);
        this.setLastModify(lastModify);
    }

    public final long getLastModify() {
        return lastModify;
    }

    public final AppRoutingResponse setLastModify(long lastModify) {
        this.lastModify = lastModify;
        return this;
    }

    public final boolean isEnabled() {
        return enabled;
    }

    public final AppRoutingResponse setEnabled(boolean enabled) {
        this.enabled = enabled;
        return this;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + Objects.hash(enabled, lastModify);
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        AppRoutingResponse other = (AppRoutingResponse)obj;
        return enabled == other.enabled && lastModify == other.lastModify;
    }

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

    public static AppRoutingResponse successOf(List data, String message, long lastModify,
        boolean enabled) {
        return new AppRoutingResponse(true, data, message, lastModify, enabled);
    }

    public static AppRoutingResponse successOf(List data, String message, long lastModify) {
        return new AppRoutingResponse(true, data, message, lastModify);
    }

    public static AppRoutingResponse successOfMessage(String message, long lastModify, boolean enabled) {
        return new AppRoutingResponse(true, message, lastModify, enabled);
    }

    public static AppRoutingResponse successOfMessage(String message, long lastModify) {
        return new AppRoutingResponse(true, message, lastModify);
    }

    public static AppRoutingResponse successOfData(List data, long lastModify, boolean enabled) {
        return new AppRoutingResponse(true, data, lastModify, enabled);
    }

    public static AppRoutingResponse successOfData(List data, long lastModify) {
        return new AppRoutingResponse(true, data, lastModify);
    }

    public static AppRoutingResponse failOf(List data, String message, long lastModify, boolean enabled) {
        return new AppRoutingResponse(false, data, message, lastModify, enabled);
    }

    public static AppRoutingResponse failOf(List data, String message, long lastModify) {
        return new AppRoutingResponse(false, data, message, lastModify);
    }

    public static AppRoutingResponse failOfMessage(String message, long lastModify, boolean enabled) {
        return new AppRoutingResponse(false, message, lastModify, enabled);
    }

    public static AppRoutingResponse failOfMessage(String message, long lastModify) {
        return new AppRoutingResponse(false, message, lastModify);
    }

    public static AppRoutingResponse failOfData(List data, long lastModify, boolean enabled) {
        return new AppRoutingResponse(false, data, lastModify, enabled);
    }

    public static AppRoutingResponse failOfData(List data, long lastModify) {
        return new AppRoutingResponse(false, data, lastModify);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy