Source Code Cross Referenced for ImmutableArrayList.java in  » EJB-Server-JBoss-4.2.1 » cluster » org » jboss » ha » framework » interfaces » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » cluster » org.jboss.ha.framework.interfaces 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package org.jboss.ha.framework.interfaces;
023:
024:        import java.io.ObjectStreamException;
025:        import java.util.ArrayList;
026:        import java.util.Collection;
027:        import java.util.Iterator;
028:        import java.util.List;
029:        import java.util.ListIterator;
030:
031:        /**
032:         * Subclasses ArrayList but throws an UnsupportedOperationException from
033:         * any method that would change the internal data members.  Any iterators
034:         * that are returned do the same.
035:         * 
036:         * All other methods are delegated to the ArrayList that is passed to the 
037:         * constructor, so creating an instance of this class does not result in
038:         * making a copy of the internal element array of the source array list.
039:         * 
040:         * @author <a href="brian.stansberry@jboss.com">Brian Stansberry</a>
041:         * @version $Revision: 1.1 $
042:         */
043:        public class ImmutableArrayList extends ArrayList {
044:            /** The serialVersionUID */
045:            private static final long serialVersionUID = -7080841600873898901L;
046:
047:            private ArrayList delegate;
048:
049:            ImmutableArrayList(ArrayList source) {
050:                this .delegate = source;
051:            }
052:
053:            // Delegated Methods
054:
055:            public Object clone() {
056:                return delegate.clone();
057:            }
058:
059:            public boolean contains(Object elem) {
060:                return delegate.contains(elem);
061:            }
062:
063:            public Object get(int index) {
064:                return delegate.get(index);
065:            }
066:
067:            public int indexOf(Object elem) {
068:                return delegate.indexOf(elem);
069:            }
070:
071:            public boolean isEmpty() {
072:                return delegate.isEmpty();
073:            }
074:
075:            public int lastIndexOf(Object elem) {
076:                return delegate.lastIndexOf(elem);
077:            }
078:
079:            public int size() {
080:                return delegate.size();
081:            }
082:
083:            public Object[] toArray() {
084:                return delegate.toArray();
085:            }
086:
087:            public Object[] toArray(Object[] a) {
088:                return delegate.toArray(a);
089:            }
090:
091:            public boolean equals(Object o) {
092:                return delegate.equals(o);
093:            }
094:
095:            public int hashCode() {
096:                return delegate.hashCode();
097:            }
098:
099:            public List subList(int fromIndex, int toIndex) {
100:                return delegate.subList(fromIndex, toIndex);
101:            }
102:
103:            public boolean containsAll(Collection c) {
104:                return delegate.containsAll(c);
105:            }
106:
107:            public String toString() {
108:                return delegate.toString();
109:            }
110:
111:            // Immutable Methods
112:
113:            public void add(int arg0, Object arg1) {
114:                throw new UnsupportedOperationException(
115:                        "Target list is immutable; mutator methods are not supported");
116:            }
117:
118:            public boolean add(Object arg0) {
119:                throw new UnsupportedOperationException(
120:                        "Target list is immutable; mutator methods are not supported");
121:            }
122:
123:            public boolean addAll(Collection arg0) {
124:                throw new UnsupportedOperationException(
125:                        "Target list is immutable; mutator methods are not supported");
126:            }
127:
128:            public boolean addAll(int arg0, Collection arg1) {
129:                throw new UnsupportedOperationException(
130:                        "Target list is immutable; mutator methods are not supported");
131:            }
132:
133:            public void clear() {
134:                throw new UnsupportedOperationException(
135:                        "Target list is immutable; mutator methods are not supported");
136:            }
137:
138:            public void ensureCapacity(int arg0) {
139:                throw new UnsupportedOperationException(
140:                        "Target list is immutable; mutator methods are not supported");
141:            }
142:
143:            public Object remove(int arg0) {
144:                throw new UnsupportedOperationException(
145:                        "Target list is immutable; mutator methods are not supported");
146:            }
147:
148:            public boolean remove(Object arg0) {
149:                throw new UnsupportedOperationException(
150:                        "Target list is immutable; mutator methods are not supported");
151:            }
152:
153:            protected void removeRange(int arg0, int arg1) {
154:                throw new UnsupportedOperationException(
155:                        "Target list is immutable; mutator methods are not supported");
156:            }
157:
158:            public Object set(int arg0, Object arg1) {
159:                throw new UnsupportedOperationException(
160:                        "Target list is immutable; mutator methods are not supported");
161:            }
162:
163:            public void trimToSize() {
164:                throw new UnsupportedOperationException(
165:                        "Target list is immutable; mutator methods are not supported");
166:            }
167:
168:            public Iterator iterator() {
169:                return new ImmutableArrayListIterator(super .listIterator());
170:            }
171:
172:            public ListIterator listIterator() {
173:                return new ImmutableArrayListIterator(super .listIterator());
174:            }
175:
176:            public ListIterator listIterator(int index) {
177:                return new ImmutableArrayListIterator(super .listIterator(index));
178:            }
179:
180:            public boolean removeAll(Collection arg0) {
181:                throw new UnsupportedOperationException(
182:                        "Target list is immutable; mutator methods are not supported");
183:            }
184:
185:            public boolean retainAll(Collection arg0) {
186:                throw new UnsupportedOperationException(
187:                        "Target list is immutable; mutator methods are not supported");
188:            }
189:
190:            // Serialization
191:
192:            private Object writeReplace() throws ObjectStreamException {
193:                return delegate;
194:            }
195:
196:            // Inner Classes
197:
198:            private class ImmutableArrayListIterator implements  ListIterator {
199:
200:                private ListIterator delegate;
201:
202:                ImmutableArrayListIterator(ListIterator delegate) {
203:                    this .delegate = delegate;
204:                }
205:
206:                public boolean hasNext() {
207:                    return delegate.hasNext();
208:                }
209:
210:                public Object next() {
211:                    return delegate.next();
212:                }
213:
214:                public void remove() {
215:                    throw new UnsupportedOperationException(
216:                            "Target list is immutable; mutator methods are not supported");
217:
218:                }
219:
220:                public void add(Object o) {
221:                    throw new UnsupportedOperationException(
222:                            "Target list is immutable; mutator methods are not supported");
223:                }
224:
225:                public boolean hasPrevious() {
226:                    return delegate.hasPrevious();
227:                }
228:
229:                public int nextIndex() {
230:                    return delegate.nextIndex();
231:                }
232:
233:                public Object previous() {
234:                    return delegate.previous();
235:                }
236:
237:                public int previousIndex() {
238:                    return delegate.previousIndex();
239:                }
240:
241:                public void set(Object o) {
242:                    throw new UnsupportedOperationException(
243:                            "Target list is immutable; mutator methods are not supported");
244:                }
245:
246:            }
247:
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.