Source Code Cross Referenced for WrapperMap.java in  » Web-Services » restlet-1.0.8 » org » restlet » util » 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 » Web Services » restlet 1.0.8 » org.restlet.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 Noelios Consulting.
003:         * 
004:         * The contents of this file are subject to the terms of the Common Development
005:         * and Distribution License (the "License"). You may not use this file except in
006:         * compliance with the License.
007:         * 
008:         * You can obtain a copy of the license at
009:         * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
010:         * language governing permissions and limitations under the License.
011:         * 
012:         * When distributing Covered Code, include this CDDL HEADER in each file and
013:         * include the License file at http://www.opensource.org/licenses/cddl1.txt If
014:         * applicable, add the following below this CDDL HEADER, with the fields
015:         * enclosed by brackets "[]" replaced with your own identifying information:
016:         * Portions Copyright [yyyy] [name of copyright owner]
017:         */
018:
019:        package org.restlet.util;
020:
021:        import java.util.Collection;
022:        import java.util.Map;
023:        import java.util.Set;
024:        import java.util.TreeMap;
025:
026:        /**
027:         * Map wrapper. Modifiable map that delegates all methods to a wrapped map. This
028:         * allows an easy subclassing.
029:         * 
030:         * @author Jerome Louvel (contact@noelios.com)
031:         * @see java.util.Collections
032:         * @see java.util.List
033:         */
034:        public class WrapperMap<K, V> implements  Map<K, V> {
035:            /** The delegate map. */
036:            private Map<K, V> delegate;
037:
038:            /**
039:             * Constructor.
040:             */
041:            public WrapperMap() {
042:                this .delegate = null;
043:            }
044:
045:            /**
046:             * Constructor.
047:             * 
048:             * @param delegate
049:             *            The delegate list.
050:             */
051:            public WrapperMap(Map<K, V> delegate) {
052:                this .delegate = delegate;
053:            }
054:
055:            /**
056:             * Removes all mappings from this Map.
057:             */
058:            public void clear() {
059:                getDelegate().clear();
060:            }
061:
062:            /**
063:             * Returns true if this map contains a mapping for the specified key.
064:             * 
065:             * @param key
066:             *            The key to look up.
067:             * @return True if this map contains a mapping for the specified key.
068:             */
069:            public boolean containsKey(Object key) {
070:                return getDelegate().containsKey(key);
071:            }
072:
073:            /**
074:             * Returns true if this map maps one or more keys to the specified value.
075:             * 
076:             * @param value
077:             *            The value to look up
078:             * @return True if this map maps one or more keys to the specified value.
079:             */
080:            public boolean containsValue(Object value) {
081:                return getDelegate().containsValue(value);
082:            }
083:
084:            /**
085:             * Returns a set view of the mappings contained in this map.
086:             * 
087:             * @return A set view of the mappings contained in this map.
088:             */
089:            public Set<Entry<K, V>> entrySet() {
090:                return getDelegate().entrySet();
091:            }
092:
093:            /**
094:             * Compares the specified object with this map for equality.
095:             * 
096:             * @param o
097:             *            Object to be compared for equality with this map.
098:             * @return True if the specified object is equal to this map.
099:             */
100:            public boolean equals(Object o) {
101:                return getDelegate().equals(o);
102:            }
103:
104:            /**
105:             * Returns the value to which this map maps the specified key.
106:             * 
107:             * @param key
108:             *            Key whose associated value is to be returned.
109:             * @return The value to which this map maps the specified key, or null if
110:             *         the map contains no mapping for this key.
111:             */
112:            public V get(Object key) {
113:                return getDelegate().get(key);
114:            }
115:
116:            /**
117:             * Returns the delegate list.
118:             * 
119:             * @return The delegate list.
120:             */
121:            protected Map<K, V> getDelegate() {
122:                if (this .delegate == null) {
123:                    this .delegate = new TreeMap<K, V>();
124:                }
125:
126:                return this .delegate;
127:            }
128:
129:            /**
130:             * Returns the hash code value for this map.
131:             * 
132:             * @return The hash code value for this map.
133:             */
134:            public int hashCode() {
135:                return getDelegate().hashCode();
136:            }
137:
138:            /**
139:             * Returns true if this map contains no key-value mappings.
140:             * 
141:             * @return True if this map contains no key-value mappings.
142:             */
143:            public boolean isEmpty() {
144:                return getDelegate().isEmpty();
145:            }
146:
147:            /**
148:             * Returns a set view of the keys contained in this map.
149:             * 
150:             * @return A set view of the keys contained in this map.
151:             */
152:            public Set<K> keySet() {
153:                return getDelegate().keySet();
154:            }
155:
156:            /**
157:             * Associates the specified value with the specified key in this map
158:             * (optional operation).
159:             * 
160:             * @param key
161:             *            Key with which the specified value is to be associated.
162:             * @param value
163:             *            Value to be associated with the specified key.
164:             * @return The previous value associated with specified key, or null if
165:             *         there was no mapping for key. A null return can also indicate
166:             *         that the map previously associated null with the specified key,
167:             *         if the implementation supports null values.
168:             */
169:            public V put(K key, V value) {
170:                return getDelegate().put(key, value);
171:            }
172:
173:            /**
174:             * Copies all of the mappings from the specified map to this map (optional
175:             * operation).
176:             * 
177:             * @param t
178:             *            Mappings to be stored in this map.
179:             */
180:            public void putAll(Map<? extends K, ? extends V> t) {
181:                getDelegate().putAll(t);
182:            }
183:
184:            /**
185:             * Removes the mapping for this key from this map if it is present (optional
186:             * operation).
187:             * 
188:             * @param key
189:             *            Key whose mapping is to be removed from the map.
190:             * @return The previous value associated with specified key, or null if
191:             *         there was no mapping for key.
192:             */
193:            public V remove(Object key) {
194:                return getDelegate().remove(key);
195:            }
196:
197:            /**
198:             * Returns the number of key-value mappings in this map.
199:             * 
200:             * @return The number of key-value mappings in this map.
201:             */
202:            public int size() {
203:                return getDelegate().size();
204:            }
205:
206:            /**
207:             * Returns a collection view of the values contained in this map.
208:             * 
209:             * @return A collection view of the values contained in this map.
210:             */
211:            public Collection<V> values() {
212:                return getDelegate().values();
213:            }
214:
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.