java/sql-dk/src/info/globalcode/sql/dk/InvalidOptionsException.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 15 Dec 2013 19:20:50 +0100
branchv_0
changeset 1 f32dac78d13a
child 16 5b8fcd35d4d6
permissions -rw-r--r--
WOW some classes LOL; TODO: refactor
franta-hg@1
     1
package info.globalcode.sql.dk;
franta-hg@1
     2
franta-hg@1
     3
import java.util.ArrayList;
franta-hg@1
     4
import java.util.Collection;
franta-hg@1
     5
import java.util.Collections;
franta-hg@1
     6
franta-hg@1
     7
/**
franta-hg@1
     8
 *
franta-hg@1
     9
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@1
    10
 */
franta-hg@1
    11
public class InvalidOptionsException extends Exception {
franta-hg@1
    12
franta-hg@1
    13
	private final Collection<OptionProblem> problems = new ArrayList<>();
franta-hg@1
    14
franta-hg@1
    15
	public Collection<OptionProblem> getProblems() {
franta-hg@1
    16
		return Collections.unmodifiableCollection(problems);
franta-hg@1
    17
	}
franta-hg@1
    18
franta-hg@1
    19
	public void addProblem(OptionProblem p) {
franta-hg@1
    20
		problems.add(p);
franta-hg@1
    21
	}
franta-hg@1
    22
franta-hg@1
    23
	public boolean hasProblems() {
franta-hg@1
    24
		return !problems.isEmpty();
franta-hg@1
    25
	}
franta-hg@1
    26
franta-hg@1
    27
	public static class OptionProblem {
franta-hg@1
    28
franta-hg@1
    29
		private String description;
franta-hg@1
    30
franta-hg@1
    31
		public OptionProblem(String description) {
franta-hg@1
    32
			this.description = description;
franta-hg@1
    33
		}
franta-hg@1
    34
franta-hg@1
    35
		public String getDescription() {
franta-hg@1
    36
			return description;
franta-hg@1
    37
		}
franta-hg@1
    38
	}
franta-hg@1
    39
}