Source Code Cross Referenced for MapFacade.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » script » el » 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 » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.script.el.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.script.el.util;
020:
021:        import java.util.Collection;
022:        import java.util.Enumeration;
023:        import java.util.HashMap;
024:        import java.util.Map;
025:        import java.util.Set;
026:        import java.util.Iterator;
027:        import java.util.Collections;
028:
029:        /**
030:         * Facade used to put a {@link Map} API atop another object.  For example, a sublcass might allow
031:         * the {@link javax.servlet.http.HttpSession} to be treated like a Map for purposes of referencing session
032:         * attributes from expressions.
033:         */
034:        public abstract class MapFacade implements  Map {
035:
036:            private Map _map = null;
037:
038:            /**
039:             * Subclasses should implement this method in order to get a value from the
040:             * backing object.
041:             * @param key the key of the object
042:             * @return the value associated with the <code>key</code>.
043:             */
044:            protected abstract Object getValue(Object key);
045:
046:            /**
047:             * Subclasses should implement this method in order to set a value in
048:             * the backing object.
049:             * @param key the key of the object
050:             * @param value the value to associate with the key
051:             * @return the previous value associated with this key or <code>null</code> if no value was associated
052:             */
053:            protected abstract Object putValue(Object key, Object value);
054:
055:            /**
056:             * Get an {@link Enumeration} of the keys associated with a backing object.  Note,
057:             * an {@link Enumeration} is used here because many web-based attribute maps
058:             * expose their list of keys only as enumeration objects.
059:             * @return the {@link Enumeration} of keys available from the backing object
060:             */
061:            protected abstract Iterator getKeys();
062:
063:            /*--------------------------------------------------------------------------
064:
065:            Implementation of the {@link Map} interface.
066:
067:            -------------------------------------------------------------------------- */
068:            public void clear() {
069:            }
070:
071:            public boolean containsKey(Object key) {
072:                return getValue(key) != null;
073:            }
074:
075:            public Object get(Object key) {
076:                return getValue(key);
077:            }
078:
079:            public Object put(Object key, Object value) {
080:                return putValue(key, value);
081:            }
082:
083:            public boolean containsValue(Object key) {
084:                assert getMap() != null;
085:                return getMap().containsValue(key);
086:            }
087:
088:            public Set entrySet() {
089:                assert getMap() != null;
090:                return Collections.unmodifiableSet(getMap().entrySet());
091:            }
092:
093:            public boolean isEmpty() {
094:                assert getMap() != null;
095:                return getMap().isEmpty();
096:            }
097:
098:            public Set keySet() {
099:                assert getMap() != null;
100:                return Collections.unmodifiableSet(getMap().keySet());
101:            }
102:
103:            public void putAll(Map t) {
104:                assert getMap() != null;
105:                getMap().putAll(t);
106:            }
107:
108:            public Object remove(Object key) {
109:                assert getMap() != null;
110:                return getMap().remove(key);
111:            }
112:
113:            public int size() {
114:                assert getMap() != null;
115:                return getMap().size();
116:            }
117:
118:            public Collection values() {
119:                assert getMap() != null;
120:                return Collections.unmodifiableCollection(getMap().values());
121:            }
122:
123:            private Map getMap() {
124:                if (_map == null) {
125:                    _map = new HashMap();
126:
127:                    Iterator keys = getKeys();
128:                    assert keys != null;
129:                    while (keys.hasNext()) {
130:                        Object key = keys.next();
131:                        _map.put(key, getValue(key));
132:                    }
133:                }
134:                return _map;
135:            }
136:        }
w_w__w.j__a_va_2_s.c___o___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.