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

com.harrys.hyppo.source.api.ValidationException Maven / Gradle / Ivy

There is a newer version: 0.6.4
Show newest version
package com.harrys.hyppo.source.api;

import java.io.Serializable;
import java.util.List;

/**
 * Created by jpetty on 7/7/15.
 */
public final class ValidationException extends Exception implements Serializable {
    private static final long serialVersionUID = 1L;

    public ValidationException(){
        super();
    }

    public ValidationException(String message){
        super(message);
    }

    public ValidationException(String message, Throwable cause){
        super(message, cause);
    }

    public static final ValidationException withMessages(final List messages){

        if (messages.isEmpty()){
            return new ValidationException();
        } else {
            final StringBuilder sb = new StringBuilder();

            for (int i = 0; i < messages.size(); i++){
                sb.append(messages.get(i));
                if (i + 1 < messages.size()){
                    sb.append('\n');
                }
            }

            return new ValidationException(sb.toString());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy