view src/main/java/de/intevation/lada/validation/ValidationException.java @ 366:567ce7697fc7 0.5

Code documentation.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 10 Sep 2013 15:55:54 +0200
parents 92affd9467f8
children 183f8116d9a6
line wrap: on
line source
package de.intevation.lada.validation;

import java.util.HashMap;
import java.util.Map;

/**
 * Exception used for validation errors.
 * 
 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
 */
public class ValidationException
extends Exception
{
    /**
     * Errors saved in this exception.
     */
    private Map<String, Integer> errors;

    /**
     * Warnings saved in this exception.
     */
    private Map<String, Integer> warnings;

    /**
     * Do not allow an empty ValidationException object. 
     */
    private ValidationException() {
    }

    /**
     * Create a new instance with errors.
     *
     * @param errors
     */
    public ValidationException(Map<String, Integer> errors) {
        this();
        this.errors = errors;
        this.warnings = new HashMap<String, Integer>();
    }

    /**
     * Create a new instance with errors and warnings.
     *
     * @param errors
     */
    public ValidationException(
        Map<String, Integer> errors,
        Map<String, Integer> warnings
    ) {
        this();
        this.errors = errors;
        this.warnings = warnings;
    }

    /**
     * Getter for the errors.
     *
     * @return the errors
     */
    public Map<String, Integer> getErrors() {
        return errors;
    }

    /**
     * Getter for the warnings.
     *
     * @return the warnings
     */
    public Map<String, Integer> getWarnings() {
        return warnings;
    }
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)