View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors.
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   * 
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.common.collection;
25  
26  import java.util.Iterator;
27  import net.jcip.annotations.Immutable;
28  import org.modeshape.common.i18n.I18n;
29  import org.modeshape.common.util.CheckArg;
30  
31  /**
32   * An immutable wrapper for a mutable {@link Problems}.
33   */
34  @Immutable
35  public class ImmutableProblems implements Problems {
36  
37      private static final long serialVersionUID = 1L;
38      private final Problems delegate;
39  
40      public ImmutableProblems( Problems delegate ) {
41          CheckArg.isNotNull(delegate, "delegate");
42          this.delegate = delegate;
43      }
44  
45      /**
46       * {@inheritDoc}
47       * 
48       * @see org.modeshape.common.collection.Problems#addError(org.modeshape.common.i18n.I18n, java.lang.Object[])
49       */
50      public void addError( I18n message,
51                            Object... params ) {
52          throw new UnsupportedOperationException();
53      }
54  
55      /**
56       * {@inheritDoc}
57       * 
58       * @see org.modeshape.common.collection.Problems#addError(java.lang.String, java.lang.String, org.modeshape.common.i18n.I18n,
59       *      java.lang.Object[])
60       */
61      public void addError( String resource,
62                            String location,
63                            I18n message,
64                            Object... params ) {
65          throw new UnsupportedOperationException();
66      }
67  
68      /**
69       * {@inheritDoc}
70       * 
71       * @see org.modeshape.common.collection.Problems#addError(int, org.modeshape.common.i18n.I18n, java.lang.Object[])
72       */
73      public void addError( int code,
74                            I18n message,
75                            Object... params ) {
76          throw new UnsupportedOperationException();
77      }
78  
79      /**
80       * {@inheritDoc}
81       * 
82       * @see org.modeshape.common.collection.Problems#addError(int, String, String, I18n, Object...)
83       */
84      public void addError( int code,
85                            String resource,
86                            String location,
87                            I18n message,
88                            Object... params ) {
89          throw new UnsupportedOperationException();
90      }
91  
92      /**
93       * {@inheritDoc}
94       * 
95       * @see org.modeshape.common.collection.Problems#addError(java.lang.Throwable, org.modeshape.common.i18n.I18n,
96       *      java.lang.Object[])
97       */
98      public void addError( Throwable throwable,
99                            I18n message,
100                           Object... params ) {
101         throw new UnsupportedOperationException();
102     }
103 
104     /**
105      * {@inheritDoc}
106      * 
107      * @see org.modeshape.common.collection.Problems#addError(java.lang.Throwable, java.lang.String, java.lang.String,
108      *      org.modeshape.common.i18n.I18n,java.lang.Object[])
109      */
110     public void addError( Throwable throwable,
111                           String resource,
112                           String location,
113                           I18n message,
114                           Object... params ) {
115         throw new UnsupportedOperationException();
116     }
117 
118     /**
119      * {@inheritDoc}
120      * 
121      * @see org.modeshape.common.collection.Problems#addError(java.lang.Throwable, int, org.modeshape.common.i18n.I18n,
122      *      java.lang.Object[])
123      */
124     public void addError( Throwable throwable,
125                           int code,
126                           I18n message,
127                           Object... params ) {
128         throw new UnsupportedOperationException();
129     }
130 
131     /**
132      * {@inheritDoc}
133      * 
134      * @see org.modeshape.common.collection.Problems#addError(java.lang.Throwable, int, java.lang.String, java.lang.String,
135      *      org.modeshape.common.i18n.I18n, java.lang.Object[])
136      */
137     public void addError( Throwable throwable,
138                           int code,
139                           String resource,
140                           String location,
141                           I18n message,
142                           Object... params ) {
143         throw new UnsupportedOperationException();
144     }
145 
146     /**
147      * {@inheritDoc}
148      * 
149      * @see org.modeshape.common.collection.Problems#addInfo(org.modeshape.common.i18n.I18n, java.lang.Object[])
150      */
151     public void addInfo( I18n message,
152                          Object... params ) {
153         throw new UnsupportedOperationException();
154     }
155 
156     /**
157      * {@inheritDoc}
158      * 
159      * @see org.modeshape.common.collection.Problems#addInfo(java.lang.String, java.lang.String, org.modeshape.common.i18n.I18n,
160      *      java.lang.Object[])
161      */
162     public void addInfo( String resource,
163                          String location,
164                          I18n message,
165                          Object... params ) {
166         throw new UnsupportedOperationException();
167     }
168 
169     /**
170      * {@inheritDoc}
171      * 
172      * @see org.modeshape.common.collection.Problems#addInfo(int, org.modeshape.common.i18n.I18n, java.lang.Object[])
173      */
174     public void addInfo( int code,
175                          I18n message,
176                          Object... params ) {
177         throw new UnsupportedOperationException();
178     }
179 
180     /**
181      * {@inheritDoc}
182      * 
183      * @see org.modeshape.common.collection.Problems#addInfo(int, java.lang.String, java.lang.String,
184      *      org.modeshape.common.i18n.I18n, java.lang.Object[])
185      */
186     public void addInfo( int code,
187                          String resource,
188                          String location,
189                          I18n message,
190                          Object... params ) {
191         throw new UnsupportedOperationException();
192     }
193 
194     /**
195      * {@inheritDoc}
196      * 
197      * @see org.modeshape.common.collection.Problems#addInfo(java.lang.Throwable, org.modeshape.common.i18n.I18n,
198      *      java.lang.Object[])
199      */
200     public void addInfo( Throwable throwable,
201                          I18n message,
202                          Object... params ) {
203         throw new UnsupportedOperationException();
204     }
205 
206     /**
207      * {@inheritDoc}
208      * 
209      * @see org.modeshape.common.collection.Problems#addInfo(java.lang.Throwable, java.lang.String, java.lang.String,
210      *      org.modeshape.common.i18n.I18n, java.lang.Object[])
211      */
212     public void addInfo( Throwable throwable,
213                          String resource,
214                          String location,
215                          I18n message,
216                          Object... params ) {
217         throw new UnsupportedOperationException();
218     }
219 
220     /**
221      * {@inheritDoc}
222      * 
223      * @see org.modeshape.common.collection.Problems#addInfo(java.lang.Throwable, int, org.modeshape.common.i18n.I18n,
224      *      java.lang.Object[])
225      */
226     public void addInfo( Throwable throwable,
227                          int code,
228                          I18n message,
229                          Object... params ) {
230         throw new UnsupportedOperationException();
231     }
232 
233     /**
234      * {@inheritDoc}
235      * 
236      * @see org.modeshape.common.collection.Problems#addInfo(java.lang.Throwable, int, java.lang.String, java.lang.String,
237      *      org.modeshape.common.i18n.I18n, java.lang.Object[])
238      */
239     public void addInfo( Throwable throwable,
240                          int code,
241                          String resource,
242                          String location,
243                          I18n message,
244                          Object... params ) {
245         throw new UnsupportedOperationException();
246     }
247 
248     /**
249      * {@inheritDoc}
250      * 
251      * @see org.modeshape.common.collection.Problems#addWarning(org.modeshape.common.i18n.I18n, java.lang.Object[])
252      */
253     public void addWarning( I18n message,
254                             Object... params ) {
255         throw new UnsupportedOperationException();
256     }
257 
258     /**
259      * {@inheritDoc}
260      * 
261      * @see org.modeshape.common.collection.Problems#addWarning(java.lang.String, java.lang.String,
262      *      org.modeshape.common.i18n.I18n, java.lang.Object[])
263      */
264     public void addWarning( String resource,
265                             String location,
266                             I18n message,
267                             Object... params ) {
268         throw new UnsupportedOperationException();
269     }
270 
271     /**
272      * {@inheritDoc}
273      * 
274      * @see org.modeshape.common.collection.Problems#addWarning(int, org.modeshape.common.i18n.I18n, java.lang.Object[])
275      */
276     public void addWarning( int code,
277                             I18n message,
278                             Object... params ) {
279         throw new UnsupportedOperationException();
280     }
281 
282     /**
283      * {@inheritDoc}
284      * 
285      * @see org.modeshape.common.collection.Problems#addWarning(int, java.lang.String, java.lang.String,
286      *      org.modeshape.common.i18n.I18n, java.lang.Object[])
287      */
288     public void addWarning( int code,
289                             String resource,
290                             String location,
291                             I18n message,
292                             Object... params ) {
293         throw new UnsupportedOperationException();
294     }
295 
296     /**
297      * {@inheritDoc}
298      * 
299      * @see org.modeshape.common.collection.Problems#addWarning(java.lang.Throwable, org.modeshape.common.i18n.I18n,
300      *      java.lang.Object[])
301      */
302     public void addWarning( Throwable throwable,
303                             I18n message,
304                             Object... params ) {
305         throw new UnsupportedOperationException();
306     }
307 
308     /**
309      * {@inheritDoc}
310      * 
311      * @see org.modeshape.common.collection.Problems#addWarning(java.lang.Throwable, java.lang.String, java.lang.String ,
312      *      org.modeshape.common.i18n.I18n,java.lang.Object[])
313      */
314     public void addWarning( Throwable throwable,
315                             String resource,
316                             String location,
317                             I18n message,
318                             Object... params ) {
319         throw new UnsupportedOperationException();
320     }
321 
322     /**
323      * {@inheritDoc}
324      * 
325      * @see org.modeshape.common.collection.Problems#addWarning(java.lang.Throwable, int, org.modeshape.common.i18n.I18n,
326      *      java.lang.Object[])
327      */
328     public void addWarning( Throwable throwable,
329                             int code,
330                             I18n message,
331                             Object... params ) {
332         throw new UnsupportedOperationException();
333     }
334 
335     /**
336      * {@inheritDoc}
337      * 
338      * @see org.modeshape.common.collection.Problems#addWarning(java.lang.Throwable, int, java.lang.String, java.lang.String,
339      *      org.modeshape.common.i18n.I18n,java.lang.Object[])
340      */
341     public void addWarning( Throwable throwable,
342                             int code,
343                             String resource,
344                             String location,
345                             I18n message,
346                             Object... params ) {
347         throw new UnsupportedOperationException();
348     }
349 
350     /**
351      * {@inheritDoc}
352      * 
353      * @see org.modeshape.common.collection.Problems#hasErrors()
354      */
355     public boolean hasErrors() {
356         return delegate.hasErrors();
357     }
358 
359     /**
360      * {@inheritDoc}
361      * 
362      * @see org.modeshape.common.collection.Problems#hasInfo()
363      */
364     public boolean hasInfo() {
365         return delegate.hasInfo();
366     }
367 
368     /**
369      * {@inheritDoc}
370      * 
371      * @see org.modeshape.common.collection.Problems#hasProblems()
372      */
373     public boolean hasProblems() {
374         return delegate.hasProblems();
375     }
376 
377     /**
378      * {@inheritDoc}
379      * 
380      * @see org.modeshape.common.collection.Problems#hasWarnings()
381      */
382     public boolean hasWarnings() {
383         return delegate.hasWarnings();
384     }
385 
386     /**
387      * {@inheritDoc}
388      * 
389      * @see org.modeshape.common.collection.Problems#isEmpty()
390      */
391     public boolean isEmpty() {
392         return delegate.isEmpty();
393     }
394 
395     /**
396      * {@inheritDoc}
397      * 
398      * @see org.modeshape.common.collection.Problems#iterator()
399      */
400     public Iterator<Problem> iterator() {
401         return new ReadOnlyIterator<Problem>(delegate.iterator());
402     }
403 
404     /**
405      * {@inheritDoc}
406      * 
407      * @see org.modeshape.common.collection.Problems#size()
408      */
409     public int size() {
410         return delegate.size();
411     }
412 
413 }