Skip to content

Method: MultipleCheckExceptions(CheckException)

1: package de.fhdw.wtf.common.exception.editor;
2:
3: import java.util.ArrayList;
4: import java.util.Collection;
5: import java.util.Iterator;
6:
7: //TODO Fehlermeldung verbessern! Es werden teilweise null Objekte als Gründe eingefügt. Es existiert keine Textmeldung über den Fehler!
8: public class MultipleCheckExceptions extends Exception {
9:         
10:         /**
11:          * generated.
12:          */
13:         private static final long serialVersionUID = 3581469331906103808L;
14:         
15:         /**
16:          * Collection of {@link CheckException}s.
17:          */
18:         private final Collection<CheckException> exc;
19:         
20:         /**
21:          * Constructor of {@link MultipleCheckExceptions}.
22:          *
23:          * @param exc
24:          * Collection of {@link CheckException}s
25:          */
26:         public MultipleCheckExceptions(final Collection<CheckException> exc) {
27:                 this.exc = exc;
28:         }
29:         
30:         /**
31:          * Constructor of {@link MultipleCheckExceptions}.
32:          *
33:          * @param exc
34:          * {@link CheckException}
35:          */
36:         public MultipleCheckExceptions(final CheckException exc) {
37:                 this(new ArrayList<CheckException>());
38:                 this.getExc().add(exc);
39:         }
40:         
41:         /**
42:          * Constructor of {@link MultipleCheckExceptions}.
43:          *
44:          */
45:         public MultipleCheckExceptions() {
46:                 this(new ArrayList<CheckException>());
47:         }
48:         
49:         /**
50:          * Returns the Collection of {@link CheckException}s.
51:          *
52:          * @return exceptions
53:          */
54:         private Collection<CheckException> getExc() {
55:                 return this.exc;
56:         }
57:         
58:         /**
59:          * Add a {@link CheckException}.
60:          *
61:          * @param c
62:          * checkException
63:          */
64:         public void add(final CheckException c) {
65:                 this.getExc().add(c);
66:         }
67:         
68:         /**
69:          * Returns true, if the collection of {@link CheckException}s is empty. Otherwise false.
70:          *
71:          * @return isEmpty
72:          */
73:         public boolean isEmpty() {
74:                 return this.getExc().isEmpty();
75:         }
76:         
77:         /**
78:          * Returns a iterator of the collection of {@link CheckException}s.
79:          *
80:          * @return iterator for exceptions
81:          */
82:         public Iterator<CheckException> iterator() {
83:                 return this.getExc().iterator();
84:         }
85:         
86:         /**
87:          * Returns the count of collected exceptions.
88:          *
89:          * @return count of exceptions
90:          */
91:         public int getExeptionCount() {
92:                 return this.exc.size();
93:         }
94: }