author | František Kučera <franta-hg@frantovo.cz> |
Mon, 17 Nov 2014 23:44:59 +0100 | |
changeset 22 | 75a0eba0ba97 |
parent 12 | 27e41d7f5e8d |
permissions | -rw-r--r-- |
franta-hg@12 | 1 |
/** |
franta-hg@12 | 2 |
* copy-image-resizer |
franta-hg@12 | 3 |
* Copyright © 2014 František Kučera (frantovo.cz) |
franta-hg@12 | 4 |
* |
franta-hg@12 | 5 |
* This program is free software: you can redistribute it and/or modify |
franta-hg@12 | 6 |
* it under the terms of the GNU General Public License as published by |
franta-hg@12 | 7 |
* the Free Software Foundation, either version 3 of the License, or |
franta-hg@12 | 8 |
* (at your option) any later version. |
franta-hg@12 | 9 |
* |
franta-hg@12 | 10 |
* This program is distributed in the hope that it will be useful, |
franta-hg@12 | 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
franta-hg@12 | 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
franta-hg@12 | 13 |
* GNU General Public License for more details. |
franta-hg@12 | 14 |
* |
franta-hg@12 | 15 |
* You should have received a copy of the GNU General Public License |
franta-hg@12 | 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
franta-hg@12 | 17 |
*/ |
franta-hg@12 | 18 |
package cz.frantovo.copyImageResizer; |
franta-hg@12 | 19 |
|
franta-hg@12 | 20 |
import java.util.ArrayList; |
franta-hg@12 | 21 |
import java.util.Collection; |
franta-hg@12 | 22 |
import java.util.Collections; |
franta-hg@12 | 23 |
|
franta-hg@12 | 24 |
/** |
franta-hg@12 | 25 |
* |
franta-hg@12 | 26 |
* @author Ing. František Kučera (frantovo.cz) |
franta-hg@12 | 27 |
*/ |
franta-hg@12 | 28 |
public class InvalidOptionsException extends CopyImageResizerException { |
franta-hg@12 | 29 |
|
franta-hg@12 | 30 |
private final Collection<OptionProblem> problems = new ArrayList<>(); |
franta-hg@12 | 31 |
|
franta-hg@12 | 32 |
public Collection<OptionProblem> getProblems() { |
franta-hg@12 | 33 |
return Collections.unmodifiableCollection(problems); |
franta-hg@12 | 34 |
} |
franta-hg@12 | 35 |
|
franta-hg@12 | 36 |
public void addProblem(OptionProblem p) { |
franta-hg@12 | 37 |
problems.add(p); |
franta-hg@12 | 38 |
} |
franta-hg@12 | 39 |
|
franta-hg@12 | 40 |
public boolean hasProblems() { |
franta-hg@12 | 41 |
return !problems.isEmpty(); |
franta-hg@12 | 42 |
} |
franta-hg@12 | 43 |
|
franta-hg@12 | 44 |
public static class OptionProblem { |
franta-hg@12 | 45 |
|
franta-hg@12 | 46 |
private final String description; |
franta-hg@12 | 47 |
private final Throwable exception; |
franta-hg@12 | 48 |
|
franta-hg@12 | 49 |
public OptionProblem(String description) { |
franta-hg@12 | 50 |
this.description = description; |
franta-hg@12 | 51 |
this.exception = null; |
franta-hg@12 | 52 |
} |
franta-hg@12 | 53 |
|
franta-hg@12 | 54 |
public OptionProblem(String description, Throwable exception) { |
franta-hg@12 | 55 |
this.description = description; |
franta-hg@12 | 56 |
this.exception = exception; |
franta-hg@12 | 57 |
} |
franta-hg@12 | 58 |
|
franta-hg@12 | 59 |
public String getDescription() { |
franta-hg@12 | 60 |
return description; |
franta-hg@12 | 61 |
} |
franta-hg@12 | 62 |
|
franta-hg@12 | 63 |
public Throwable getException() { |
franta-hg@12 | 64 |
return exception; |
franta-hg@12 | 65 |
} |
franta-hg@12 | 66 |
} |
franta-hg@12 | 67 |
|
franta-hg@12 | 68 |
} |