Source Code Cross Referenced for AbstractPropertyAccessor.java in  » J2EE » spring-framework-2.5 » org » springframework » beans » 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 » J2EE » spring framework 2.5 » org.springframework.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.beans;
018:
019:        import java.util.Arrays;
020:        import java.util.Iterator;
021:        import java.util.LinkedList;
022:        import java.util.List;
023:        import java.util.Map;
024:
025:        /**
026:         * Abstract implementation of the {@link PropertyAccessor} interface.
027:         * Provides base implementations of all convenience methods, with the
028:         * implementation of actual property access left to subclasses.
029:         *
030:         * @author Juergen Hoeller
031:         * @since 2.0
032:         * @see #getPropertyValue
033:         * @see #setPropertyValue
034:         */
035:        public abstract class AbstractPropertyAccessor extends
036:                PropertyEditorRegistrySupport implements 
037:                ConfigurablePropertyAccessor {
038:
039:            private boolean extractOldValueForEditor = false;
040:
041:            public void setExtractOldValueForEditor(
042:                    boolean extractOldValueForEditor) {
043:                this .extractOldValueForEditor = extractOldValueForEditor;
044:            }
045:
046:            public boolean isExtractOldValueForEditor() {
047:                return this .extractOldValueForEditor;
048:            }
049:
050:            public void setPropertyValue(PropertyValue pv)
051:                    throws BeansException {
052:                setPropertyValue(pv.getName(), pv.getValue());
053:            }
054:
055:            public void setPropertyValues(Map map) throws BeansException {
056:                setPropertyValues(new MutablePropertyValues(map));
057:            }
058:
059:            public void setPropertyValues(PropertyValues pvs)
060:                    throws BeansException {
061:                setPropertyValues(pvs, false, false);
062:            }
063:
064:            public void setPropertyValues(PropertyValues pvs,
065:                    boolean ignoreUnknown) throws BeansException {
066:                setPropertyValues(pvs, ignoreUnknown, false);
067:            }
068:
069:            public void setPropertyValues(PropertyValues pvs,
070:                    boolean ignoreUnknown, boolean ignoreInvalid)
071:                    throws BeansException {
072:
073:                List propertyAccessExceptions = null;
074:                List propertyValues = (pvs instanceof  MutablePropertyValues ? ((MutablePropertyValues) pvs)
075:                        .getPropertyValueList()
076:                        : Arrays.asList(pvs.getPropertyValues()));
077:                for (Iterator it = propertyValues.iterator(); it.hasNext();) {
078:                    PropertyValue pv = (PropertyValue) it.next();
079:                    try {
080:                        // This method may throw any BeansException, which won't be caught
081:                        // here, if there is a critical failure such as no matching field.
082:                        // We can attempt to deal only with less serious exceptions.
083:                        setPropertyValue(pv);
084:                    } catch (NotWritablePropertyException ex) {
085:                        if (!ignoreUnknown) {
086:                            throw ex;
087:                        }
088:                        // Otherwise, just ignore it and continue...
089:                    } catch (NullValueInNestedPathException ex) {
090:                        if (!ignoreInvalid) {
091:                            throw ex;
092:                        }
093:                        // Otherwise, just ignore it and continue...
094:                    } catch (PropertyAccessException ex) {
095:                        if (propertyAccessExceptions == null) {
096:                            propertyAccessExceptions = new LinkedList();
097:                        }
098:                        propertyAccessExceptions.add(ex);
099:                    }
100:                }
101:
102:                // If we encountered individual exceptions, throw the composite exception.
103:                if (propertyAccessExceptions != null) {
104:                    PropertyAccessException[] paeArray = (PropertyAccessException[]) propertyAccessExceptions
105:                            .toArray(new PropertyAccessException[propertyAccessExceptions
106:                                    .size()]);
107:                    throw new PropertyBatchUpdateException(paeArray);
108:                }
109:            }
110:
111:            // Redefined with public visibility.
112:            public Class getPropertyType(String propertyPath) {
113:                return null;
114:            }
115:
116:            /**
117:             * Actually get the value of a property.
118:             * @param propertyName name of the property to get the value of
119:             * @return the value of the property
120:             * @throws InvalidPropertyException if there is no such property or
121:             * if the property isn't readable
122:             * @throws PropertyAccessException if the property was valid but the
123:             * accessor method failed
124:             */
125:            public abstract Object getPropertyValue(String propertyName)
126:                    throws BeansException;
127:
128:            /**
129:             * Actually set a property value.
130:             * @param propertyName name of the property to set value of
131:             * @param value the new value
132:             * @throws InvalidPropertyException if there is no such property or
133:             * if the property isn't writable
134:             * @throws PropertyAccessException if the property was valid but the
135:             * accessor method failed or a type mismatch occured
136:             */
137:            public abstract void setPropertyValue(String propertyName,
138:                    Object value) throws BeansException;
139:
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.