franta-hg@12: /** franta-hg@12: * copy-image-resizer franta-hg@12: * Copyright © 2014 František Kučera (frantovo.cz) franta-hg@12: * franta-hg@12: * This program is free software: you can redistribute it and/or modify franta-hg@12: * it under the terms of the GNU General Public License as published by franta-hg@12: * the Free Software Foundation, either version 3 of the License, or franta-hg@12: * (at your option) any later version. franta-hg@12: * franta-hg@12: * This program is distributed in the hope that it will be useful, franta-hg@12: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@12: * GNU General Public License for more details. franta-hg@12: * franta-hg@12: * You should have received a copy of the GNU General Public License franta-hg@12: * along with this program. If not, see . franta-hg@12: */ franta-hg@12: package cz.frantovo.copyImageResizer; franta-hg@12: franta-hg@12: import java.util.ArrayList; franta-hg@12: import java.util.Collection; franta-hg@12: import java.util.Collections; franta-hg@12: franta-hg@12: /** franta-hg@12: * franta-hg@12: * @author Ing. František Kučera (frantovo.cz) franta-hg@12: */ franta-hg@12: public class InvalidOptionsException extends CopyImageResizerException { franta-hg@12: franta-hg@12: private final Collection problems = new ArrayList<>(); franta-hg@12: franta-hg@12: public Collection getProblems() { franta-hg@12: return Collections.unmodifiableCollection(problems); franta-hg@12: } franta-hg@12: franta-hg@12: public void addProblem(OptionProblem p) { franta-hg@12: problems.add(p); franta-hg@12: } franta-hg@12: franta-hg@12: public boolean hasProblems() { franta-hg@12: return !problems.isEmpty(); franta-hg@12: } franta-hg@12: franta-hg@12: public static class OptionProblem { franta-hg@12: franta-hg@12: private final String description; franta-hg@12: private final Throwable exception; franta-hg@12: franta-hg@12: public OptionProblem(String description) { franta-hg@12: this.description = description; franta-hg@12: this.exception = null; franta-hg@12: } franta-hg@12: franta-hg@12: public OptionProblem(String description, Throwable exception) { franta-hg@12: this.description = description; franta-hg@12: this.exception = exception; franta-hg@12: } franta-hg@12: franta-hg@12: public String getDescription() { franta-hg@12: return description; franta-hg@12: } franta-hg@12: franta-hg@12: public Throwable getException() { franta-hg@12: return exception; franta-hg@12: } franta-hg@12: } franta-hg@12: franta-hg@12: }