Source Code Cross Referenced for MapELResolver.java in  » Sevlet-Container » apache-tomcat-6.0.14 » javax » el » 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 » Sevlet Container » apache tomcat 6.0.14 » javax.el 
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:
018:        package javax.el;
019:
020:        import java.beans.FeatureDescriptor;
021:        import java.util.ArrayList;
022:        import java.util.Collections;
023:        import java.util.HashMap;
024:        import java.util.Iterator;
025:        import java.util.List;
026:        import java.util.Map;
027:
028:        public class MapELResolver extends ELResolver {
029:
030:            private final static Class UNMODIFIABLE = Collections
031:                    .unmodifiableMap(new HashMap()).getClass();
032:
033:            private final boolean readOnly;
034:
035:            public MapELResolver() {
036:                this .readOnly = false;
037:            }
038:
039:            public MapELResolver(boolean readOnly) {
040:                this .readOnly = readOnly;
041:            }
042:
043:            public Object getValue(ELContext context, Object base,
044:                    Object property) throws NullPointerException,
045:                    PropertyNotFoundException, ELException {
046:                if (context == null) {
047:                    throw new NullPointerException();
048:                }
049:
050:                if (base instanceof  Map) {
051:                    context.setPropertyResolved(true);
052:                    return ((Map) base).get(property);
053:                }
054:
055:                return null;
056:            }
057:
058:            public Class<?> getType(ELContext context, Object base,
059:                    Object property) throws NullPointerException,
060:                    PropertyNotFoundException, ELException {
061:                if (context == null) {
062:                    throw new NullPointerException();
063:                }
064:
065:                if (base instanceof  Map) {
066:                    context.setPropertyResolved(true);
067:                    Object obj = ((Map) base).get(property);
068:                    return (obj != null) ? obj.getClass() : null;
069:                }
070:
071:                return null;
072:            }
073:
074:            public void setValue(ELContext context, Object base,
075:                    Object property, Object value) throws NullPointerException,
076:                    PropertyNotFoundException, PropertyNotWritableException,
077:                    ELException {
078:                if (context == null) {
079:                    throw new NullPointerException();
080:                }
081:
082:                if (base instanceof  Map) {
083:                    context.setPropertyResolved(true);
084:
085:                    if (this .readOnly) {
086:                        throw new PropertyNotWritableException(message(context,
087:                                "resolverNotWriteable", new Object[] { base
088:                                        .getClass().getName() }));
089:                    }
090:
091:                    try {
092:                        ((Map) base).put(property, value);
093:                    } catch (UnsupportedOperationException e) {
094:                        throw new PropertyNotWritableException(e);
095:                    }
096:                }
097:            }
098:
099:            public boolean isReadOnly(ELContext context, Object base,
100:                    Object property) throws NullPointerException,
101:                    PropertyNotFoundException, ELException {
102:                if (context == null) {
103:                    throw new NullPointerException();
104:                }
105:
106:                if (base instanceof  Map) {
107:                    context.setPropertyResolved(true);
108:                    return this .readOnly
109:                            || UNMODIFIABLE.equals(base.getClass());
110:                }
111:
112:                return this .readOnly;
113:            }
114:
115:            public Iterator<FeatureDescriptor> getFeatureDescriptors(
116:                    ELContext context, Object base) {
117:                if (base instanceof  Map) {
118:                    Iterator itr = ((Map) base).keySet().iterator();
119:                    List<FeatureDescriptor> feats = new ArrayList<FeatureDescriptor>();
120:                    Object key;
121:                    FeatureDescriptor desc;
122:                    while (itr.hasNext()) {
123:                        key = itr.next();
124:                        desc = new FeatureDescriptor();
125:                        desc.setDisplayName(key.toString());
126:                        desc.setExpert(false);
127:                        desc.setHidden(false);
128:                        desc.setName(key.toString());
129:                        desc.setPreferred(true);
130:                        desc.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.FALSE);
131:                        desc.setValue(TYPE, key.getClass());
132:                        feats.add(desc);
133:                    }
134:                    return feats.iterator();
135:                }
136:                return null;
137:            }
138:
139:            public Class<?> getCommonPropertyType(ELContext context, Object base) {
140:                if (base instanceof  Map) {
141:                    return Object.class;
142:                }
143:                return null;
144:            }
145:
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.