001    /*
002     * JBoss DNA (http://www.jboss.org/dna)
003     * See the COPYRIGHT.txt file distributed with this work for information
004     * regarding copyright ownership.  Some portions may be licensed
005     * to Red Hat, Inc. under one or more contributor license agreements.
006     * See the AUTHORS.txt file in the distribution for a full listing of 
007     * individual contributors.
008     *
009     * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
010     * is licensed to you under the terms of the GNU Lesser General Public License as
011     * published by the Free Software Foundation; either version 2.1 of
012     * the License, or (at your option) any later version.
013     * 
014     * JBoss DNA is distributed in the hope that it will be useful,
015     * but WITHOUT ANY WARRANTY; without even the implied warranty of
016     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017     * Lesser General Public License for more details.
018     *
019     * You should have received a copy of the GNU Lesser General Public
020     * License along with this software; if not, write to the Free
021     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
022     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
023     */
024    package org.jboss.dna.common.collection;
025    
026    import java.util.Iterator;
027    import net.jcip.annotations.Immutable;
028    import org.jboss.dna.common.i18n.I18n;
029    import org.jboss.dna.common.util.CheckArg;
030    
031    /**
032     * An immutable wrapper for a mutable {@link Problems}.
033     */
034    @Immutable
035    public class ImmutableProblems implements Problems {
036    
037        private final Problems delegate;
038    
039        public ImmutableProblems( Problems delegate ) {
040            CheckArg.isNotNull(delegate, "delegate");
041            this.delegate = delegate;
042        }
043    
044        /**
045         * {@inheritDoc}
046         * 
047         * @see org.jboss.dna.common.collection.Problems#addError(org.jboss.dna.common.i18n.I18n, java.lang.Object[])
048         */
049        public void addError( I18n message,
050                              Object... params ) {
051            throw new UnsupportedOperationException();
052        }
053    
054        /**
055         * {@inheritDoc}
056         * 
057         * @see org.jboss.dna.common.collection.Problems#addError(org.jboss.dna.common.i18n.I18n, java.lang.String, java.lang.String,
058         *      java.lang.Object[])
059         */
060        public void addError( I18n message,
061                              String resource,
062                              String location,
063                              Object... params ) {
064            throw new UnsupportedOperationException();
065        }
066    
067        /**
068         * {@inheritDoc}
069         * 
070         * @see org.jboss.dna.common.collection.Problems#addError(int, org.jboss.dna.common.i18n.I18n, java.lang.Object[])
071         */
072        public void addError( int code,
073                              I18n message,
074                              Object... params ) {
075            throw new UnsupportedOperationException();
076        }
077    
078        /**
079         * {@inheritDoc}
080         * 
081         * @see org.jboss.dna.common.collection.Problems#addError(int, org.jboss.dna.common.i18n.I18n, java.lang.String,
082         *      java.lang.String, java.lang.Object[])
083         */
084        public void addError( int code,
085                              I18n message,
086                              String resource,
087                              String location,
088                              Object... params ) {
089            throw new UnsupportedOperationException();
090        }
091    
092        /**
093         * {@inheritDoc}
094         * 
095         * @see org.jboss.dna.common.collection.Problems#addError(java.lang.Throwable, org.jboss.dna.common.i18n.I18n,
096         *      java.lang.Object[])
097         */
098        public void addError( Throwable throwable,
099                              I18n message,
100                              Object... params ) {
101            throw new UnsupportedOperationException();
102        }
103    
104        /**
105         * {@inheritDoc}
106         * 
107         * @see org.jboss.dna.common.collection.Problems#addError(java.lang.Throwable, org.jboss.dna.common.i18n.I18n,
108         *      java.lang.String, java.lang.String, java.lang.Object[])
109         */
110        public void addError( Throwable throwable,
111                              I18n message,
112                              String resource,
113                              String location,
114                              Object... params ) {
115            throw new UnsupportedOperationException();
116        }
117    
118        /**
119         * {@inheritDoc}
120         * 
121         * @see org.jboss.dna.common.collection.Problems#addError(java.lang.Throwable, int, org.jboss.dna.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.jboss.dna.common.collection.Problems#addError(java.lang.Throwable, int, org.jboss.dna.common.i18n.I18n,
135         *      java.lang.String, java.lang.String, java.lang.Object[])
136         */
137        public void addError( Throwable throwable,
138                              int code,
139                              I18n message,
140                              String resource,
141                              String location,
142                              Object... params ) {
143            throw new UnsupportedOperationException();
144        }
145    
146        /**
147         * {@inheritDoc}
148         * 
149         * @see org.jboss.dna.common.collection.Problems#addInfo(org.jboss.dna.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.jboss.dna.common.collection.Problems#addInfo(org.jboss.dna.common.i18n.I18n, java.lang.String, java.lang.String,
160         *      java.lang.Object[])
161         */
162        public void addInfo( I18n message,
163                             String resource,
164                             String location,
165                             Object... params ) {
166            throw new UnsupportedOperationException();
167        }
168    
169        /**
170         * {@inheritDoc}
171         * 
172         * @see org.jboss.dna.common.collection.Problems#addInfo(int, org.jboss.dna.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.jboss.dna.common.collection.Problems#addInfo(int, org.jboss.dna.common.i18n.I18n, java.lang.String,
184         *      java.lang.String, java.lang.Object[])
185         */
186        public void addInfo( int code,
187                             I18n message,
188                             String resource,
189                             String location,
190                             Object... params ) {
191            throw new UnsupportedOperationException();
192        }
193    
194        /**
195         * {@inheritDoc}
196         * 
197         * @see org.jboss.dna.common.collection.Problems#addInfo(java.lang.Throwable, org.jboss.dna.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.jboss.dna.common.collection.Problems#addInfo(java.lang.Throwable, org.jboss.dna.common.i18n.I18n,
210         *      java.lang.String, java.lang.String, java.lang.Object[])
211         */
212        public void addInfo( Throwable throwable,
213                             I18n message,
214                             String resource,
215                             String location,
216                             Object... params ) {
217            throw new UnsupportedOperationException();
218        }
219    
220        /**
221         * {@inheritDoc}
222         * 
223         * @see org.jboss.dna.common.collection.Problems#addInfo(java.lang.Throwable, int, org.jboss.dna.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.jboss.dna.common.collection.Problems#addInfo(java.lang.Throwable, int, org.jboss.dna.common.i18n.I18n,
237         *      java.lang.String, java.lang.String, java.lang.Object[])
238         */
239        public void addInfo( Throwable throwable,
240                             int code,
241                             I18n message,
242                             String resource,
243                             String location,
244                             Object... params ) {
245            throw new UnsupportedOperationException();
246        }
247    
248        /**
249         * {@inheritDoc}
250         * 
251         * @see org.jboss.dna.common.collection.Problems#addWarning(org.jboss.dna.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.jboss.dna.common.collection.Problems#addWarning(org.jboss.dna.common.i18n.I18n, java.lang.String,
262         *      java.lang.String, java.lang.Object[])
263         */
264        public void addWarning( I18n message,
265                                String resource,
266                                String location,
267                                Object... params ) {
268            throw new UnsupportedOperationException();
269        }
270    
271        /**
272         * {@inheritDoc}
273         * 
274         * @see org.jboss.dna.common.collection.Problems#addWarning(int, org.jboss.dna.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.jboss.dna.common.collection.Problems#addWarning(int, org.jboss.dna.common.i18n.I18n, java.lang.String,
286         *      java.lang.String, java.lang.Object[])
287         */
288        public void addWarning( int code,
289                                I18n message,
290                                String resource,
291                                String location,
292                                Object... params ) {
293            throw new UnsupportedOperationException();
294        }
295    
296        /**
297         * {@inheritDoc}
298         * 
299         * @see org.jboss.dna.common.collection.Problems#addWarning(java.lang.Throwable, org.jboss.dna.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.jboss.dna.common.collection.Problems#addWarning(java.lang.Throwable, org.jboss.dna.common.i18n.I18n,
312         *      java.lang.String, java.lang.String, java.lang.Object[])
313         */
314        public void addWarning( Throwable throwable,
315                                I18n message,
316                                String resource,
317                                String location,
318                                Object... params ) {
319            throw new UnsupportedOperationException();
320        }
321    
322        /**
323         * {@inheritDoc}
324         * 
325         * @see org.jboss.dna.common.collection.Problems#addWarning(java.lang.Throwable, int, org.jboss.dna.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.jboss.dna.common.collection.Problems#addWarning(java.lang.Throwable, int, org.jboss.dna.common.i18n.I18n,
339         *      java.lang.String, java.lang.String, java.lang.Object[])
340         */
341        public void addWarning( Throwable throwable,
342                                int code,
343                                I18n message,
344                                String resource,
345                                String location,
346                                Object... params ) {
347            throw new UnsupportedOperationException();
348        }
349    
350        /**
351         * {@inheritDoc}
352         * 
353         * @see org.jboss.dna.common.collection.Problems#hasErrors()
354         */
355        public boolean hasErrors() {
356            return delegate.hasErrors();
357        }
358    
359        /**
360         * {@inheritDoc}
361         * 
362         * @see org.jboss.dna.common.collection.Problems#hasInfo()
363         */
364        public boolean hasInfo() {
365            return delegate.hasInfo();
366        }
367    
368        /**
369         * {@inheritDoc}
370         * 
371         * @see org.jboss.dna.common.collection.Problems#hasProblems()
372         */
373        public boolean hasProblems() {
374            return delegate.hasProblems();
375        }
376    
377        /**
378         * {@inheritDoc}
379         * 
380         * @see org.jboss.dna.common.collection.Problems#hasWarnings()
381         */
382        public boolean hasWarnings() {
383            return delegate.hasWarnings();
384        }
385    
386        /**
387         * {@inheritDoc}
388         * 
389         * @see org.jboss.dna.common.collection.Problems#isEmpty()
390         */
391        public boolean isEmpty() {
392            return delegate.isEmpty();
393        }
394    
395        /**
396         * {@inheritDoc}
397         * 
398         * @see org.jboss.dna.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.jboss.dna.common.collection.Problems#size()
408         */
409        public int size() {
410            return delegate.size();
411        }
412    
413    }