You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/01/19 22:44:05 UTC
svn commit: r1233585 [1/2] - in /commons/sandbox/beanutils2/trunk: ./ src/
src/changes/ src/main/ src/main/assembly/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/commons/
src/main/java/org/apache/commons/beanutil...
Author: simonetripodi
Date: Thu Jan 19 21:44:04 2012
New Revision: 1233585
URL: http://svn.apache.org/viewvc?rev=1233585&view=rev
Log:
first checkin of BeanUtils2 - fluent APIs experiment (Constructor tests already pass)
Added:
commons/sandbox/beanutils2/trunk/LICENSE.txt (with props)
commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt (with props)
commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf (with props)
commons/sandbox/beanutils2/trunk/pom.xml (with props)
commons/sandbox/beanutils2/trunk/src/
commons/sandbox/beanutils2/trunk/src/changes/
commons/sandbox/beanutils2/trunk/src/changes/changes.xml (with props)
commons/sandbox/beanutils2/trunk/src/main/
commons/sandbox/beanutils2/trunk/src/main/assembly/
commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml (with props)
commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml (with props)
commons/sandbox/beanutils2/trunk/src/main/java/
commons/sandbox/beanutils2/trunk/src/main/java/org/
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/converters/
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/converters/AbstractConverter.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/converters/package-info.java (with props)
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/package-info.java (with props)
commons/sandbox/beanutils2/trunk/src/test/
commons/sandbox/beanutils2/trunk/src/test/java/
commons/sandbox/beanutils2/trunk/src/test/java/org/
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/ConstructorsTestCase.java (with props)
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBean.java (with props)
Added: commons/sandbox/beanutils2/trunk/LICENSE.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/LICENSE.txt?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/LICENSE.txt (added)
+++ commons/sandbox/beanutils2/trunk/LICENSE.txt Thu Jan 19 21:44:04 2012
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
Propchange: commons/sandbox/beanutils2/trunk/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/LICENSE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/beanutils2/trunk/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt (added)
+++ commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt Thu Jan 19 21:44:04 2012
@@ -0,0 +1,65 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+$Id$
+
+
+ Commons BeanUtils2 Package
+ Version 0.1
+ Release Notes
+
+
+INTRODUCTION
+============
+
+This is the first Apache Commons BeanUtils2 release.
+
+IMPORTANT NOTES
+================
+
+BREAKING CHANGES:
+
+ * none.
+
+DEPENDENCIES
+=============
+
+Apache Commons BeanUtils2 does not have any dependency.
+
+NEW FEATURES
+=============
+
+ * none
+
+BUGS FROM PREVIOUS RELEASE
+===========================
+
+ * none.
+
+IMPROVEMENTS OVER PREVIOUS RELEASE
+===================================
+
+ * none.
+
+DEPRECATIONS
+============
+
+ * none.
+
+OTHER NOTES
+============
+
+ * none.
Propchange: commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/beanutils2/trunk/RELEASE-NOTES.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf (added)
+++ commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf Thu Jan 19 21:44:04 2012
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:asfext="http://projects.apache.org/ns/asfext#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:doap="http://usefulinc.com/ns/doap#" xml:lang="en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+ <Project rdf:about="http://commons.apache.org/beanutils2/">
+ <name>Apache Commons BeanUtils2</name>
+ <homepage rdf:resource="http://commons.apache.org/sandbox/beanutils2/"/>
+ <programming-language>Java</programming-language>
+ <category rdf:resource="http://projects.apache.org/category/library"/>
+ <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
+ <bug-database rdf:resource="http://issues.apache.org/jira/browse/GRAPH"/>
+ <download-page rdf:resource="http://commons.apache.org/digester/download_beanutils2.cgi"/>
+ <asfext:pmc rdf:resource="http://commons.apache.org/"/>
+ <shortdesc xml:lang="en">
+ BeanUtils provides an easy-to-use but flexible wrapper around reflection and introspection.
+ </shortdesc>
+ <description xml:lang="en">
+ BeanUtils provides an easy-to-use but flexible wrapper around reflection and introspection.
+ </description>
+ <repository>
+ <SVNRepository>
+ <browse rdf:resource="http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk"/>
+ <location rdf:resource="http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk"/>
+ </SVNRepository>
+ </repository>
+ <release>
+ <Version>
+ <name>common-beanutils2</name>
+ <created>TBD</created>
+ <revision>0.1</revision>
+ </Version>
+ </release>
+ <mailing-list rdf:resource="http://commons.apache.org/mail-lists.html"/>
+ </Project>
+</rdf:RDF>
Propchange: commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/doap_beanutils2.rdf
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Added: commons/sandbox/beanutils2/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/pom.xml?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/pom.xml (added)
+++ commons/sandbox/beanutils2/trunk/pom.xml Thu Jan 19 21:44:04 2012
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>23</version>
+ </parent>
+
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-beanutils2</artifactId>
+ <version>0.1-SNAPSHOT</version>
+
+ <name>Apache Commons BeanUtils2</name>
+ <description>
+ BeanUtils provides an easy-to-use but flexible wrapper around reflection and introspection.
+ </description>
+ <url>http://commons.apache.org/sandbox/beanutils2/</url>
+ <inceptionYear>2012</inceptionYear>
+
+ <developers>
+ <developer>
+ <name>Christian Grobmeier</name>
+ <id>grobmeier</id>
+ <email>grobmeier at apache dot org</email>
+ </developer>
+ <developer>
+ <name>Maurizio Cucchiara</name>
+ <id>mcucchiara</id>
+ <email>mcucchiara at apache dot org</email>
+ </developer>
+ <developer>
+ <name>Simone Tripodi</name>
+ <id>simonetripodi</id>
+ <email>simonetripodi at apache dot org</email>
+ </developer>
+ </developers>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/commons/sandbox/beanutils2/trunk</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/sandbox/beanutils2/trunk</developerConnection>
+ <url>http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk</url>
+ </scm>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://issues.apache.org/jira/browse/SANDBOX</url>
+ </issueManagement>
+ <distributionManagement>
+ <!-- Cannot define in parent ATM, see COMMONSSITE-26 -->
+ <site>
+ <id>people.apache.org</id>
+ <name>Apache Commons Site</name>
+ <url>${commons.deployment.protocol}://people.apache.org/www/commons.apache.org/sandbox/beanutils2</url>
+ </site>
+ </distributionManagement>
+
+ <properties>
+ <maven.compile.source>1.5</maven.compile.source>
+ <maven.compile.target>1.5</maven.compile.target>
+ <commons.componentid>beanutils</commons.componentid>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>NOTICE.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>false</filtering>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <issueLinkTemplate>%URL%/../%ISSUE%</issueLinkTemplate>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>changes-report</report>
+ <report>jira-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ <headerLocation>config/maven-header.txt</headerLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ <!--Use default rules-->
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Propchange: commons/sandbox/beanutils2/trunk/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/beanutils2/trunk/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/changes/changes.xml?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/changes/changes.xml (added)
+++ commons/sandbox/beanutils2/trunk/src/changes/changes.xml Thu Jan 19 21:44:04 2012
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<document xmlns="http://maven.apache.org/changes/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
+ <properties>
+ <title>Apache Commons BeanUtils2 - Changes</title>
+ </properties>
+ <body>
+ <release version="0.1" date="201?-??-??" description="First release.">
+
+ </release>
+ </body>
+</document>
Propchange: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml (added)
+++ commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml Thu Jan 19 21:44:04 2012
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<assembly>
+ <id>bin</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <includeSiteDirectory>false</includeSiteDirectory>
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>RELEASE-NOTES.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/site/apidocs</directory>
+ <outputDirectory>apidocs</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
Propchange: commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/beanutils2/trunk/src/main/assembly/bin.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml (added)
+++ commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml Thu Jan 19 21:44:04 2012
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<assembly>
+ <id>src</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <baseDirectory>${project.artifactId}-${project.version}-src</baseDirectory>
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>pom.xml</include>
+ <include>RELEASE-NOTES*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src</directory>
+ </fileSet>
+ </fileSets>
+</assembly>
Propchange: commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/beanutils2/trunk/src/main/assembly/src.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,58 @@
+package org.apache.commons.beanutils2;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.apache.commons.beanutils2.Assertions.checkNotNull;
+
+public final class Argument<T>
+{
+
+ public static <V> Argument<V> argument( V value )
+ {
+ value = checkNotNull( value, "Null not supported when specifying value only" );
+ @SuppressWarnings( "unchecked" )
+ Class<V> type = (Class<V>) value.getClass();
+ return argument( type, value );
+ }
+
+ public static <V> Argument<V> argument( Class<V> type, V value )
+ {
+ type = checkNotNull( type, "type must be specified (while value is nullable)" );
+ return new Argument<V>( type, value );
+ }
+
+ private final Class<T> type;
+
+ private final T value;
+
+ private Argument( Class<T> type, T value )
+ {
+ this.type = type;
+ this.value = value;
+ }
+
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ public T getValue()
+ {
+ return value;
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,25 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface ArgumentsAccessor<B>
+{
+
+ BeanAccessor<B> withArguments( Argument<?>...arguments );
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ArgumentsAccessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,111 @@
+package org.apache.commons.beanutils2;
+
+import static java.lang.String.format;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Code partially extracted from Google Collections
+ */
+final class Assertions
+{
+
+ private Assertions()
+ {
+ // do nothing
+ }
+
+ /**
+ * Ensures the truth of an expression involving one or more parameters to the
+ * calling method.
+ *
+ * @param expression a boolean expression
+ * @param errorMessageTemplate a template for the exception message should the
+ * check fail. The message is formed by replacing each {@code %s}
+ * placeholder in the template with an argument. These are matched by
+ * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
+ * Unmatched arguments will be appended to the formatted message in square
+ * braces. Unmatched placeholders will be left as-is.
+ * @param errorMessageArgs the arguments to be substituted into the message
+ * template. Arguments are converted to strings using
+ * {@link String#valueOf(Object)}.
+ * @throws IllegalArgumentException if {@code expression} is false
+ * @throws NullPointerException if the check fails and either {@code
+ * errorMessageTemplate} or {@code errorMessageArgs} is null (don't let
+ * this happen)
+ */
+ public static void checkArgument( boolean expression, String errorMessageTemplate, Object... errorMessageArgs )
+ {
+ if ( !expression )
+ {
+ throw new IllegalArgumentException( format( errorMessageTemplate, errorMessageArgs ) );
+ }
+ }
+
+ /**
+ * Ensures the truth of an expression involving the state of the calling
+ * instance, but not involving any parameters to the calling method.
+ *
+ * @param expression a boolean expression
+ * @param errorMessageTemplate a template for the exception message should the
+ * check fail. The message is formed by replacing each {@code %s}
+ * placeholder in the template with an argument. These are matched by
+ * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
+ * Unmatched arguments will be appended to the formatted message in square
+ * braces. Unmatched placeholders will be left as-is.
+ * @param errorMessageArgs the arguments to be substituted into the message template.
+ * @throws IllegalStateException if {@code expression} is false
+ * @throws NullPointerException if the check fails and either {@code
+ * errorMessageTemplate} or {@code errorMessageArgs} is null (don't let
+ * this happen)
+ */
+ public static void checkState( boolean expression, String errorMessageTemplate, Object... errorMessageArgs )
+ {
+ if ( !expression )
+ {
+ throw new IllegalStateException( format( errorMessageTemplate, errorMessageArgs ) );
+ }
+ }
+
+ /**
+ * Ensures that an object reference passed as a parameter to the calling
+ * method is not null.
+ *
+ * @param reference an object reference
+ * @param errorMessageTemplate a template for the exception message should the
+ * check fail. The message is formed by replacing each {@code %s}
+ * placeholder in the template with an argument. These are matched by
+ * position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
+ * Unmatched arguments will be appended to the formatted message in square
+ * braces. Unmatched placeholders will be left as-is.
+ * @param errorMessageArgs the arguments to be substituted into the message
+ * template. Arguments are converted to strings using
+ * {@link String#valueOf(Object)}.
+ * @return the non-null reference that was validated
+ * @throws NullPointerException if {@code reference} is null
+ */
+ public static <T> T checkNotNull( T reference, String errorMessageTemplate, Object... errorMessageArgs )
+ {
+ if ( reference == null )
+ {
+ // If either of these parameters is null, the right thing happens anyway
+ throw new NullPointerException( format( errorMessageTemplate, errorMessageArgs ) );
+ }
+ return reference;
+ }
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Assertions.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,69 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+public interface BeanAccessor<B>
+{
+
+ // get
+
+ BeanAccessor<?> getProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ BeanAccessor<?> getIndexedProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ BeanAccessor<?> getMappedProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ B get();
+
+ <V> V cast();
+
+ // set
+
+ BeanPropertySetter<B> setProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ // clone
+
+ B cloneBean()
+ throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException;
+
+ <T extends B> void copyPropertiesTo( T target )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ // description
+
+ Map<String, Object> describe()
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException;
+
+ void populate( Map<String, Object> properties );
+
+ // methods invocation
+
+ ArgumentsAccessor<B> invokeMethod( String methodName )
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ ArgumentsAccessor<B> invokeExactMethod( String methodName )
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanAccessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,25 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface BeanPropertySetter<B>
+{
+
+ <V> BeanAccessor<B> withValue( V value );
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanPropertySetter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,51 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.apache.commons.beanutils2.Assertions.checkNotNull;
+
+public final class BeanUtils
+{
+
+ // POJO/JavaBean stuff
+
+ public static <B> BeanAccessor<B> on( B bean )
+ {
+ bean = checkNotNull( bean, "No bean specified" );
+
+ return null;
+ }
+
+ // introspection stuff
+
+ public static <B> ClassAccessor<B> on( Class<B> beanType )
+ {
+ beanType = checkNotNull( beanType, "No bean class specified" );
+
+ return new DefaultClassAccessor<B>( beanType );
+ }
+
+ /**
+ * Hidden constructor, this class cannot be instantiated directly
+ */
+ private BeanUtils()
+ {
+ // do nothing
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,43 @@
+package org.apache.commons.beanutils2;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+
+public interface ClassAccessor<B>
+{
+
+ // constructors
+
+ BeanAccessor<B> newInstance()
+ throws InstantiationException, IllegalAccessException;
+
+ BeanAccessor<B> invokeConstructor( Argument<?>... arguments )
+ throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException,
+ NoSuchMethodException;
+
+ BeanAccessor<B> invokeExactConstructor( Argument<?>...arguments )
+ throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException,
+ NoSuchMethodException;
+
+ // static methods invocation
+
+ ArgumentsAccessor<?> invokeStaticMethod( String methodName );
+
+ ArgumentsAccessor<?> invokeExactStaticMethod( String methodName );
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/ClassAccessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,37 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Type;
+
+/**
+ *
+ *
+ * @param <S> The source object type
+ * @param <T> The target object type
+ */
+public interface Converter<S, T>
+{
+
+ T convert( S input );
+
+ Type getSourceType();
+
+ Type getTargetType();
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Converter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,98 @@
+package org.apache.commons.beanutils2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+final class DefaultBeanAccessor<B>
+ implements BeanAccessor<B>
+{
+
+ private final B bean;
+
+ public DefaultBeanAccessor( B bean )
+ {
+ this.bean = bean;
+ }
+
+ public BeanAccessor<?> getProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public BeanAccessor<?> getIndexedProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public BeanAccessor<?> getMappedProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public B get()
+ {
+ return bean;
+ }
+
+ public <V> V cast()
+ {
+ @SuppressWarnings( "unchecked" )
+ V returned = (V) bean;
+ return returned;
+ }
+
+ public BeanPropertySetter<B> setProperty( String name )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public B cloneBean()
+ throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends B> void copyPropertiesTo( T target )
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Map<String, Object> describe()
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void populate( Map<String, Object> properties )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public ArgumentsAccessor<B> invokeMethod( String methodName )
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArgumentsAccessor<B> invokeExactMethod( String methodName )
+ throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanAccessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,270 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static java.lang.reflect.Modifier.isPublic;
+import static org.apache.commons.beanutils2.Assertions.checkNotNull;
+import static org.apache.commons.beanutils2.TypeUtils.isAssignmentCompatible;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+final class DefaultClassAccessor<B>
+ implements ClassAccessor<B>
+{
+
+ private final Class<B> beanClass;
+
+ public DefaultClassAccessor( Class<B> beanClass )
+ {
+ this.beanClass = beanClass;
+ }
+
+ // pure new class instantiation
+
+ /**
+ * {@inheritDoc}
+ */
+ public BeanAccessor<B> newInstance()
+ throws InstantiationException, IllegalAccessException
+ {
+ B bean = beanClass.newInstance();
+ return new DefaultBeanAccessor<B>( bean );
+ }
+
+ // constructors
+
+ /**
+ * {@inheritDoc}
+ */
+ public BeanAccessor<B> invokeConstructor( Argument<?>... arguments )
+ throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException,
+ NoSuchMethodException
+ {
+ arguments = checkNotNull( arguments,
+ "Null arguments not admitted - don't pass any argument to use %s empty constructor",
+ beanClass.getName() );
+ return invokeConstructor( getMatchingAccessibleConstructor( getParameterTypes( arguments ) ), arguments );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BeanAccessor<B> invokeExactConstructor( Argument<?>... arguments )
+ throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException,
+ NoSuchMethodException
+ {
+ arguments = checkNotNull( arguments,
+ "Null arguments not admitted - don't pass any argument to use %s empty constructor",
+ beanClass.getName() );
+ return invokeConstructor( getAccessibleConstructor( beanClass.getConstructor( getParameterTypes( arguments ) ) ),
+ arguments );
+ }
+
+ /**
+ *
+ *
+ * @param constructor
+ * @return
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ * @throws IllegalArgumentException
+ * @throws NoSuchMethodException
+ */
+ private BeanAccessor<B> invokeConstructor( Constructor<B> constructor, Argument<?>... arguments )
+ throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException,
+ NoSuchMethodException
+ {
+ if ( null == constructor )
+ {
+ throw new NoSuchMethodException( "No such accessible constructor on object: " + beanClass.getName() );
+ }
+
+ int argumentsLength = arguments.length;
+ Object[] parameterObjects = new Object[argumentsLength];
+ for ( int i = 0; i < argumentsLength; i++ )
+ {
+ parameterObjects[i] = arguments[i].getValue();
+ }
+
+ B bean = constructor.newInstance( parameterObjects );
+ return new DefaultBeanAccessor<B>( bean );
+ }
+
+ private static Class<?>[] getParameterTypes( Argument<?>...arguments )
+ {
+ int argumentsLength = arguments.length;
+ Class<?>[] parameterTypes = new Class[argumentsLength];
+ for ( int i = 0; i < argumentsLength; i++ )
+ {
+ parameterTypes[i] = arguments[i].getType();
+ }
+ return parameterTypes;
+ }
+
+ /**
+ * <p>Find an accessible constructor with compatible parameters.
+ * Compatible parameters mean that every method parameter is assignable from
+ * the given parameters. In other words, it finds constructor that will take
+ * the parameters given.</p>
+ *
+ * <p>First it checks if there is constructor matching the exact signature.
+ * If no such, all the constructors of the class are tested if their signatures
+ * are assignment compatible with the parameter types.
+ * The first matching constructor is returned.</p>
+ *
+ * @param beanClass find constructor for this class
+ * @param parameterTypes find method with compatible parameters
+ * @return a valid Constructor object. If there's no matching constructor, returns <code>null</code>.
+ */
+ private Constructor<B> getMatchingAccessibleConstructor( Class<?>...parameterTypes )
+ {
+ // see if we can find the method directly
+ // most of the time this works and it's much faster
+ try
+ {
+ Constructor<B> ctor = beanClass.getConstructor( parameterTypes );
+ try
+ {
+ //
+ // XXX Default access superclass workaround
+ //
+ // When a public class has a default access superclass
+ // with public methods, these methods are accessible.
+ // Calling them from compiled code works fine.
+ //
+ // Unfortunately, using reflection to invoke these methods
+ // seems to (wrongly) to prevent access even when the method
+ // modifer is public.
+ //
+ // The following workaround solves the problem but will only
+ // work from sufficiently privilages code.
+ //
+ // Better workarounds would be greatfully accepted.
+ //
+ ctor.setAccessible( true );
+ }
+ catch ( SecurityException se )
+ {
+ /* SWALLOW, if workaround fails don't fret. */
+ }
+ return ctor;
+ }
+ catch ( NoSuchMethodException e )
+ {
+ /* SWALLOW */
+ }
+
+ // search through all methods
+ int paramSize = parameterTypes.length;
+
+ for ( Constructor<B> ctor : beanClass.getConstructors() )
+ {
+ // compare parameters
+ Class<?>[] ctorParams = ctor.getParameterTypes();
+ int ctorParamSize = ctorParams.length;
+ if ( ctorParamSize == paramSize )
+ {
+ boolean match = true;
+ for ( int n = 0; n < ctorParamSize; n++ )
+ {
+ if ( !isAssignmentCompatible( ctorParams[n], parameterTypes[n] ) )
+ {
+ match = false;
+ break;
+ }
+ }
+
+ if ( match )
+ {
+ // get accessible version of method
+ ctor = getAccessibleConstructor( ctor );
+ if ( ctor != null )
+ {
+ try
+ {
+ ctor.setAccessible( true );
+ }
+ catch ( SecurityException se )
+ {
+ /*
+ * Swallow SecurityException TODO: Why?
+ */
+ }
+ return ctor;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns accessible version of the given constructor.
+ * @param ctor prototype constructor object.
+ * @return <code>null</code> if accessible constructor can not be found.
+ * @see java.lang.SecurityManager
+ */
+ private static <T> Constructor<T> getAccessibleConstructor( Constructor<T> ctor )
+ {
+ // Make sure we have a method to check
+ if ( ctor == null )
+ {
+ return ( null );
+ }
+
+ // If the requested method is not public we cannot call it
+ if ( !isPublic( ctor.getModifiers() ) )
+ {
+ return ( null );
+ }
+
+ // If the declaring class is public, we are done
+ Class<T> beanClass = ctor.getDeclaringClass();
+ if ( isPublic( beanClass.getModifiers() ) )
+ {
+ return ( ctor );
+ }
+
+ // what else can we do?
+ return null;
+ }
+
+ // static methods
+
+ /**
+ * {@inheritDoc}
+ */
+ public ArgumentsAccessor<?> invokeStaticMethod( String methodName )
+ {
+ methodName = checkNotNull( methodName, "Impossible to execute null static method in %s", beanClass.getName() );
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ArgumentsAccessor<?> invokeExactStaticMethod( String methodName )
+ {
+ methodName = checkNotNull( methodName, "Impossible to execute null static method in %s", beanClass.getName() );
+ return null;
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultClassAccessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,126 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static java.util.Collections.synchronizedMap;
+
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+final class MethodsRegistry
+{
+
+ private static final MethodsRegistry INSTANCE = new MethodsRegistry();
+
+ public static MethodsRegistry getInstance()
+ {
+ return INSTANCE;
+ }
+
+ private final Map<MethodDescriptor, WeakReference<Method>> cache =
+ synchronizedMap( new WeakHashMap<MethodDescriptor, WeakReference<Method>>() );
+
+ private MethodsRegistry()
+ {
+ // this class cannot be instantiated
+ }
+
+ public void putMethod( Method method, boolean exact, Class<?> cls, String methodName, Class<?>... paramTypes )
+ {
+ cache.put( new MethodDescriptor( exact, cls, methodName, paramTypes ), new WeakReference<Method>( method ) );
+ }
+
+ public Method getMethod( boolean exact, Class<?> cls, String methodName, Class<?>... paramTypes )
+ {
+ Reference<Method> methodReference = cache.get( new MethodDescriptor( exact, cls, methodName, paramTypes ) );
+ if ( methodReference != null )
+ {
+ return methodReference.get();
+ }
+ return null;
+ }
+
+ /**
+ * Represents the key to looking up a Method by reflection.
+ */
+ private static final class MethodDescriptor
+ {
+
+ private final Class<?> cls;
+
+ private final String methodName;
+
+ private final Class<?>[] paramTypes;
+
+ private final boolean exact;
+
+ private final int hashCode;
+
+ /**
+ * The sole constructor.
+ *
+ * @param cls the class to reflect, must not be null
+ * @param methodName the method name to obtain
+ * @param paramTypes the array of classes representing the paramater types
+ * @param exact whether the match has to be exact.
+ */
+ public MethodDescriptor( boolean exact, Class<?> cls, String methodName, Class<?>... paramTypes )
+ {
+ this.exact = exact;
+ this.cls = cls;
+ this.methodName = methodName;
+ this.paramTypes = paramTypes;
+
+ this.hashCode = methodName.length();
+ }
+
+ /**
+ * Checks for equality.
+ * @param obj object to be tested for equality
+ * @return true, if the object describes the same Method.
+ */
+ public boolean equals( Object obj )
+ {
+ // this class is used internally only - do we have to check null/isAssignable... ?
+ MethodDescriptor md = (MethodDescriptor) obj;
+
+ return ( exact == md.exact
+ && methodName.equals( md.methodName )
+ && cls.equals( md.cls )
+ && Arrays.equals( paramTypes, md.paramTypes ) );
+ }
+
+ /**
+ * Returns the string length of method name. I.e. if the
+ * hashcodes are different, the objects are different. If the
+ * hashcodes are the same, need to use the equals method to
+ * determine equality.
+ * @return the string length of method name.
+ */
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MethodsRegistry.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java?rev=1233585&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java (added)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java Thu Jan 19 21:44:04 2012
@@ -0,0 +1,182 @@
+package org.apache.commons.beanutils2;
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+final class TypeUtils
+{
+
+ /**
+ * Hidden constructor, this class cannot be instantiated directly.
+ */
+ private TypeUtils()
+ {
+ // do nothing
+ }
+
+ /**
+ * <p>Determine whether a type can be used as a parameter in a method invocation.
+ * This method handles primitive conversions correctly.</p>
+ *
+ * <p>In order words, it will match a <code>Boolean</code> to a <code>boolean</code>,
+ * a <code>Long</code> to a <code>long</code>,
+ * a <code>Float</code> to a <code>float</code>,
+ * a <code>Integer</code> to a <code>int</code>,
+ * and a <code>Double</code> to a <code>double</code>.
+ * Now logic widening matches are allowed.
+ * For example, a <code>Long</code> will not match a <code>int</code>.
+ *
+ * @param parameterType the type of parameter accepted by the method
+ * @param parameterization the type of parameter being tested
+ *
+ * @return true if the assignement is compatible.
+ */
+ public static final boolean isAssignmentCompatible( Class<?> parameterType, Class<?> parameterization )
+ {
+ // try plain assignment
+ if ( parameterType.isAssignableFrom( parameterization ) )
+ {
+ return true;
+ }
+
+ if ( parameterType.isPrimitive() )
+ {
+ // this method does *not* do widening - you must specify exactly
+ // is this the right behaviour?
+ Class<?> parameterWrapperClazz = getPrimitiveWrapper( parameterType );
+ if ( parameterWrapperClazz != null )
+ {
+ return parameterWrapperClazz.equals( parameterization );
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Gets the wrapper object class for the given primitive type class.
+ * For example, passing <code>boolean.class</code> returns <code>Boolean.class</code>
+ * @param primitiveType the primitive type class for which a match is to be found
+ * @return the wrapper type associated with the given primitive
+ * or null if no match is found
+ */
+ public static Class<?> getPrimitiveWrapper( Class<?> primitiveType )
+ {
+ // does anyone know a better strategy than comparing names?
+ if ( boolean.class.equals( primitiveType ) )
+ {
+ return Boolean.class;
+ }
+ else if ( float.class.equals( primitiveType ) )
+ {
+ return Float.class;
+ }
+ else if ( long.class.equals( primitiveType ) )
+ {
+ return Long.class;
+ }
+ else if ( int.class.equals( primitiveType ) )
+ {
+ return Integer.class;
+ }
+ else if ( short.class.equals( primitiveType ) )
+ {
+ return Short.class;
+ }
+ else if ( byte.class.equals( primitiveType ) )
+ {
+ return Byte.class;
+ }
+ else if ( double.class.equals( primitiveType ) )
+ {
+ return Double.class;
+ }
+ else if ( char.class.equals( primitiveType ) )
+ {
+ return Character.class;
+ }
+ return null;
+ }
+
+ /**
+ * Gets the class for the primitive type corresponding to the primitive wrapper class given.
+ * For example, an instance of <code>Boolean.class</code> returns a <code>boolean.class</code>.
+ * @param wrapperType the
+ * @return the primitive type class corresponding to the given wrapper class,
+ * null if no match is found
+ */
+ public static Class<?> getPrimitiveType( Class<?> wrapperType )
+ {
+ // does anyone know a better strategy than comparing names?
+ if ( Boolean.class.equals( wrapperType ) )
+ {
+ return boolean.class;
+ }
+ else if ( Float.class.equals( wrapperType ) )
+ {
+ return float.class;
+ }
+ else if ( Long.class.equals( wrapperType ) )
+ {
+ return long.class;
+ }
+ else if ( Integer.class.equals( wrapperType ) )
+ {
+ return int.class;
+ }
+ else if ( Short.class.equals( wrapperType ) )
+ {
+ return short.class;
+ }
+ else if ( Byte.class.equals( wrapperType ) )
+ {
+ return byte.class;
+ }
+ else if ( Double.class.equals( wrapperType ) )
+ {
+ return double.class;
+ }
+ else if ( Character.class.equals( wrapperType ) )
+ {
+ return char.class;
+ }
+ return null;
+ }
+
+ /**
+ * Find a non primitive representation for given primitive class.
+ *
+ * @param clazz the class to find a representation for, not null
+ * @return the original class if it not a primitive. Otherwise the wrapper class. Not null
+ */
+ public static Class<?> toNonPrimitiveClass( Class<?> clazz )
+ {
+ if ( clazz.isPrimitive() )
+ {
+ Class<?> primitiveClazz = getPrimitiveWrapper( clazz );
+ // the above method returns
+ if ( primitiveClazz != null )
+ {
+ return primitiveClazz;
+ }
+ return clazz;
+ }
+ return clazz;
+ }
+
+}
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/TypeUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain