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