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

com.gs.api.accelrx.web.client.validation.ResponseValidationResult Maven / Gradle / Ivy

The newest version!
package com.gs.api.accelrx.web.client.validation;

import com.google.common.collect.Sets;

import java.util.Set;

public class ResponseValidationResult {
    private boolean validationResult;
    private Set validationMessages;

    private ResponseValidationResult(boolean validationResult, Set validationMessages) {
        this.validationResult = validationResult;
        this.validationMessages = validationMessages;
    }

    public static ResponseValidationResult success() {
        return new ResponseValidationResult(true, null);
    }

    public static ResponseValidationResult fail(String validationMessage) {
        return new ResponseValidationResult(false, Sets.newHashSet(validationMessage));
    }

    public static ResponseValidationResult fail(String... validationMessages) {
        return new ResponseValidationResult(false, Sets.newHashSet(validationMessages));
    }

    public static ResponseValidationResult fail(Set validationMessages) {
        return new ResponseValidationResult(false, validationMessages);
    }

    public boolean isValid() {
        return this.validationResult;
    }

    public Set validationMessages() {
        return validationMessages;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy