Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / exception / ListBaseException.java @ 23150

History | View | Annotate | Download (4.29 KB)

1
package org.gvsig.tools.exception;
2

    
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.Iterator;
6
import java.util.List;
7
import java.util.ListIterator;
8

    
9
/**
10
 * @author Equipo de desarrollo de gvSIG
11
 *
12
 */
13
public abstract class ListBaseException extends BaseException implements List{
14
        private List exceptions = new ArrayList();
15
        
16
        /* (non-Javadoc)
17
         * @see java.util.Collection#size()
18
         */
19
        public int size() {
20
                return this.exceptions.size();
21
        }
22

    
23
        /* (non-Javadoc)
24
         * @see java.util.Collection#isEmpty()
25
         */
26
        public boolean isEmpty() {
27
                return this.exceptions.isEmpty();
28
        }
29

    
30
        /* (non-Javadoc)
31
         * @see java.util.Collection#contains(java.lang.Object)
32
         */
33
        public boolean contains(Object arg0) {
34
                return this.exceptions.contains(arg0);
35
        }
36

    
37
        /* (non-Javadoc)
38
         * @see java.util.Collection#toArray()
39
         */
40
        public Object[] toArray() {
41
                return this.exceptions.toArray();
42
        }
43

    
44
        /**
45
         * @param arg0
46
         * @return
47
         */
48
        public Object[] toArray(Object[] arg0) {
49
                return this.exceptions.toArray(arg0);
50
        }
51

    
52
        /**
53
         * @param arg0
54
         * @return
55
         */
56
        public boolean add(Object arg0) {
57
                return this.exceptions.add(arg0);
58
        }
59

    
60
        /* (non-Javadoc)
61
         * @see java.util.Collection#remove(java.lang.Object)
62
         */
63
        public boolean remove(Object arg0) {
64
                return this.exceptions.remove(arg0);
65
        }
66

    
67
        /**
68
         * @param arg0
69
         * @return
70
         */
71
        public boolean containsAll(Collection arg0) {
72
                return this.exceptions.contains(arg0);
73
        }
74

    
75
        /**
76
         * @param arg0
77
         * @return
78
         */
79
        public boolean addAll(Collection arg0) {
80
                return this.exceptions.addAll(arg0);
81
        }
82

    
83
        /**
84
         * @param arg0
85
         * @param arg1
86
         * @return
87
         */
88
        public boolean addAll(int arg0, Collection arg1) {
89
                return this.exceptions.addAll(arg0, arg1);
90
        }
91

    
92
        /**
93
         * @param arg0
94
         * @return
95
         */
96
        public boolean removeAll(Collection arg0) {
97
                return this.exceptions.removeAll(arg0);
98
        }
99

    
100
        /**
101
         * @param arg0
102
         * @return
103
         */
104
        public boolean retainAll(Collection arg0) {
105
                return this.exceptions.retainAll(arg0);
106
        }
107

    
108
        /* (non-Javadoc)
109
         * @see java.util.Collection#clear()
110
         */
111
        public void clear() {
112
                this.exceptions.clear();
113
        }
114

    
115
        /* (non-Javadoc)
116
         * @see java.util.List#get(int)
117
         */
118
        public Object get(int arg0) {
119
                return this.exceptions.get(arg0);
120
        }
121

    
122
        /**
123
         * @param arg0
124
         * @param arg1
125
         * @return
126
         */
127
        public Object set(int arg0, Object arg1) {
128
                return this.exceptions.set(arg0, arg1);
129
        }
130

    
131
        /**
132
         * @param arg0
133
         * @param arg1
134
         */
135
        public void add(int arg0, Object arg1) {
136
                this.exceptions.add(arg0, arg1);
137
        }
138

    
139
        /* (non-Javadoc)
140
         * @see java.util.List#remove(int)
141
         */
142
        public Object remove(int arg0) {
143
                return this.exceptions.remove(arg0);
144
        }
145

    
146
        /* (non-Javadoc)
147
         * @see java.util.List#indexOf(java.lang.Object)
148
         */
149
        public int indexOf(Object arg0) {
150
                return this.exceptions.indexOf(arg0);
151
        }
152

    
153
        /* (non-Javadoc)
154
         * @see java.util.List#lastIndexOf(java.lang.Object)
155
         */
156
        public int lastIndexOf(Object arg0) {
157
                return this.exceptions.lastIndexOf(arg0);
158
        }
159

    
160
        /* (non-Javadoc)
161
         * @see java.util.List#listIterator()
162
         */
163
        public ListIterator listIterator() {
164
                return this.exceptions.listIterator();
165
        }
166

    
167
        /* (non-Javadoc)
168
         * @see java.util.List#listIterator(int)
169
         */
170
        public ListIterator listIterator(int arg0) {
171
                return this.exceptions.listIterator(arg0);
172
        }
173

    
174
        /* (non-Javadoc)
175
         * @see java.util.List#subList(int, int)
176
         */
177
        public List subList(int arg0, int arg1) {
178
                return this.exceptions.subList(arg0, arg1);
179
        }
180
        
181
        /* (non-Javadoc)
182
         * @see java.lang.Throwable#getMessage()
183
         */
184
        public String getMessage() {
185
                String msg = super.getMessage();
186
                Exception bex;
187
                Iterator iter=this.exceptions.iterator();
188
                while (iter.hasNext()) {
189
                        bex = (Exception) iter.next();
190
                        msg = msg + "\n  " + bex.getMessage();
191
                }
192
                return msg;
193
        }
194
        
195
        /* (non-Javadoc)
196
         * @see org.gvsig.exceptions.IBaseException#getLocalizedMessage(org.gvsig.exceptions.IExceptionTranslator, int)
197
         */
198
        public String getLocalizedMessage(IExceptionTranslator exceptionTranslator, int indent) {
199
                String msg = super.getLocalizedMessage(exceptionTranslator, indent);
200
                Exception bex;
201
                Iterator iter=this.exceptions.iterator();
202
                while (iter.hasNext()) {
203
                        bex = (Exception) iter.next();
204
                        if( bex instanceof BaseException ) {
205
                                msg = msg + "\n  " + ((BaseException)bex).getLocalizedMessage(exceptionTranslator, indent);                                
206
                        } else {
207
                                msg = msg + "\n  " + bex.getLocalizedMessage();
208
                        }
209
                }
210
                return BaseException.insertBlanksAtStart(msg,indent);
211
        }
212

    
213
}