Weld SVN: r6373 - api/trunk/cdi/src/main/resources.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-02 08:38:25 -0400 (Wed, 02 Jun 2010)
New Revision: 6373
Modified:
api/trunk/cdi/src/main/resources/beans_1_0.xsd
Log:
WELD-500
Modified: api/trunk/cdi/src/main/resources/beans_1_0.xsd
===================================================================
--- api/trunk/cdi/src/main/resources/beans_1_0.xsd 2010-06-02 12:05:19 UTC (rev 6372)
+++ api/trunk/cdi/src/main/resources/beans_1_0.xsd 2010-06-02 12:38:25 UTC (rev 6373)
@@ -44,11 +44,12 @@
</xs:documentation>
</xs:annotation>
<xs:complexType>
- <xs:all>
- <xs:element ref="javaee:interceptors" minOccurs="0" />
- <xs:element ref="javaee:decorators" minOccurs="0" />
- <xs:element ref="javaee:alternatives" minOccurs="0" />
- </xs:all>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="javaee:interceptors" />
+ <xs:element ref="javaee:decorators" />
+ <xs:element ref="javaee:alternatives" />
+ <xs:any namespace="##other" processContents="lax"/>
+ </xs:choice>
</xs:complexType>
</xs:element>
14 years, 5 months
Weld SVN: r6372 - doc/trunk/reference/src/main/docbook/en-US.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-02 08:05:19 -0400 (Wed, 02 Jun 2010)
New Revision: 6372
Modified:
doc/trunk/reference/src/main/docbook/en-US/Author_Group.xml
doc/trunk/reference/src/main/docbook/en-US/Book_Info.xml
doc/trunk/reference/src/main/docbook/en-US/beans.xml
doc/trunk/reference/src/main/docbook/en-US/decorators.xml
doc/trunk/reference/src/main/docbook/en-US/dependencies.xml
doc/trunk/reference/src/main/docbook/en-US/ee.xml
doc/trunk/reference/src/main/docbook/en-US/environments.xml
doc/trunk/reference/src/main/docbook/en-US/events.xml
doc/trunk/reference/src/main/docbook/en-US/example.xml
doc/trunk/reference/src/main/docbook/en-US/extend.xml
doc/trunk/reference/src/main/docbook/en-US/extensions.xml
doc/trunk/reference/src/main/docbook/en-US/gettingstarted.xml
doc/trunk/reference/src/main/docbook/en-US/injection.xml
doc/trunk/reference/src/main/docbook/en-US/interceptors.xml
doc/trunk/reference/src/main/docbook/en-US/intro.xml
doc/trunk/reference/src/main/docbook/en-US/master.xml
doc/trunk/reference/src/main/docbook/en-US/next.xml
doc/trunk/reference/src/main/docbook/en-US/part1.xml
doc/trunk/reference/src/main/docbook/en-US/part2.xml
doc/trunk/reference/src/main/docbook/en-US/part3.xml
doc/trunk/reference/src/main/docbook/en-US/part4.xml
doc/trunk/reference/src/main/docbook/en-US/part5.xml
doc/trunk/reference/src/main/docbook/en-US/producermethods.xml
doc/trunk/reference/src/main/docbook/en-US/resources.xml
doc/trunk/reference/src/main/docbook/en-US/ri-spi.xml
doc/trunk/reference/src/main/docbook/en-US/scopescontexts.xml
doc/trunk/reference/src/main/docbook/en-US/specialization.xml
doc/trunk/reference/src/main/docbook/en-US/stereotypes.xml
doc/trunk/reference/src/main/docbook/en-US/viewlayers.xml
doc/trunk/reference/src/main/docbook/en-US/weldexamples.xml
doc/trunk/reference/src/main/docbook/en-US/xml.xml
Log:
update docbook dtd version
Modified: doc/trunk/reference/src/main/docbook/en-US/Author_Group.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/Author_Group.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/Author_Group.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<authorgroup>
<author>
Modified: doc/trunk/reference/src/main/docbook/en-US/Book_Info.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/Book_Info.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/Book_Info.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<bookinfo>
<title>Weld - JSR-299 Reference Implementation</title>
<subtitle>
Modified: doc/trunk/reference/src/main/docbook/en-US/beans.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/beans.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/beans.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="beanscdi">
<title>More about beans</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/decorators.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/decorators.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/decorators.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="decorators">
<title>Decorators</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/dependencies.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/dependencies.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/dependencies.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<!-- TODO this XML file should be generated by a script that reads the dependencies from a centralized source -->
<appendix id="dependencies">
<title>Weld project dependencies</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/ee.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/ee.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/ee.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="ee">
<title>Java EE integration</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/environments.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/environments.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/environments.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="environments">
<title>Application servers and environments supported by Weld</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/events.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/events.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/events.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="events">
<title>Events</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/example.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/example.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/example.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="example">
<title>JSF web application example</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/extend.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/extend.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/extend.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="extend">
<title>Portable extensions</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/extensions.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/extensions.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/extensions.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="extensions">
<!-- TODO turn this into an extensions primer and have a separate guide for writing
Modified: doc/trunk/reference/src/main/docbook/en-US/gettingstarted.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/gettingstarted.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/gettingstarted.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="gettingstarted">
<title>Getting started with Weld</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/injection.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/injection.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/injection.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="injection">
<title>Dependency injection and programmatic lookup</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/interceptors.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/interceptors.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/interceptors.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="interceptors">
<title>Interceptors</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/intro.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/intro.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/intro.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="intro">
<title>Introduction</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/master.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/master.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/master.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding="utf-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<book lang="en">
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: doc/trunk/reference/src/main/docbook/en-US/next.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/next.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/next.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="next">
<title>Next steps</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/part1.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/part1.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/part1.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<partintro>
<!-- This part could probably be split into a chapter of it's own, perhaps "Overview" with subsection for Concepts
Modified: doc/trunk/reference/src/main/docbook/en-US/part2.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/part2.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/part2.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<partintro>
<para>
Modified: doc/trunk/reference/src/main/docbook/en-US/part3.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/part3.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/part3.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<partintro>
<para>
Modified: doc/trunk/reference/src/main/docbook/en-US/part4.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/part4.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/part4.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<partintro>
<para>
Modified: doc/trunk/reference/src/main/docbook/en-US/part5.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/part5.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/part5.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<partintro>
<para>
Modified: doc/trunk/reference/src/main/docbook/en-US/producermethods.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/producermethods.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/producermethods.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="producermethods">
<title>Producer methods</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/resources.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/resources.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/resources.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="resources">
<title>Java EE component environment resources</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/ri-spi.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/ri-spi.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/ri-spi.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,4 +1,4 @@
-<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<appendix id="ri-spi">
<title>Integrating Weld into other environments</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/scopescontexts.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/scopescontexts.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/scopescontexts.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="scopescontexts">
<title>Scopes and contexts</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/specialization.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/specialization.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/specialization.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="specialization">
<title>Specialization, inheritance and alternatives</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/stereotypes.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/stereotypes.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/stereotypes.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="stereotypes">
<title>Stereotypes</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/viewlayers.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/viewlayers.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/viewlayers.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="viewlayers">
<title>Alternative view layers</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/weldexamples.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/weldexamples.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/weldexamples.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="weldexamples">
<title>Diving into the Weld examples</title>
Modified: doc/trunk/reference/src/main/docbook/en-US/xml.xml
===================================================================
--- doc/trunk/reference/src/main/docbook/en-US/xml.xml 2010-06-01 16:34:09 UTC (rev 6371)
+++ doc/trunk/reference/src/main/docbook/en-US/xml.xml 2010-06-02 12:05:19 UTC (rev 6372)
@@ -1,5 +1,5 @@
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ ]>
<chapter id="xml">
<title>Defining beans using XML</title>
14 years, 5 months
Weld SVN: r6371 - in extensions/trunk/src/main/java/org/jboss/weld/extensions/util: properties and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-01 12:34:09 -0400 (Tue, 01 Jun 2010)
New Revision: 6371
Added:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AbstractBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AnnotatedBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Properties.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypeAnnotatedBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypedBeanProperty.java
Removed:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
Log:
tidy up on properties stuff
Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java 2010-06-01 13:58:26 UTC (rev 6370)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -1,365 +0,0 @@
-package org.jboss.weld.extensions.util;
-
-import java.beans.Introspector;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-
-/**
- * Base class for bean property wrappers
- *
- * @author Shane Bryzak
- */
-public class AbstractBeanProperty
-{
- /**
- * Subclasses should provide an implementation of FieldMatcher to determine
- * whether a Field contains the bean property
- */
- interface FieldMatcher
- {
- boolean matches(Field f);
- }
-
- /**
- * Subclasses should provide an implementation of MethodMatcher to determine
- * whether a method provides the bean property
- */
- interface MethodMatcher
- {
- boolean matches(Method m);
- }
-
- /**
- * Property field
- */
- private Field propertyField;
-
- /**
- * Property getter method
- */
- private Method propertyGetter;
-
- /**
- * Property setter method
- */
- private Method propertySetter;
-
- /**
- * Property name
- */
- private String name;
-
- /**
- * Flag indicating whether the bean property value is contained in a field
- */
- private boolean isFieldProperty;
-
- /**
- * Flag indicating whether the property exists
- */
- private boolean exists = false;
-
- private Type propertyType;
-
- private FieldMatcher fieldMatcher;
-
- private MethodMatcher methodMatcher;
-
- /**
- *
- * @param targetClass
- */
- public AbstractBeanProperty(Class<?> targetClass, FieldMatcher fieldMatcher,
- MethodMatcher methodMatcher)
- {
- this.fieldMatcher = fieldMatcher;
- this.methodMatcher = methodMatcher;
-
- // First check declared fields
- for (Field f : targetClass.getDeclaredFields())
- {
- if (fieldMatcher.matches(f))
- {
- setupFieldProperty(f);
- exists = true;
- return;
- }
- }
-
- // Then check public fields, in case it's inherited
- for (Field f : targetClass.getFields())
- {
- if (fieldMatcher.matches(f))
- {
- setupFieldProperty(f);
- exists = true;
- return;
- }
- }
-
- // Then check public methods (we ignore private methods)
- for (Method m : targetClass.getMethods())
- {
- if (methodMatcher.matches(m))
- {
- String methodName = m.getName();
-
- if ( m.getName().startsWith("get") )
- {
- this.name = Introspector.decapitalize( m.getName().substring(3) );
- }
- else if ( methodName.startsWith("is") )
- {
- this.name = Introspector.decapitalize( m.getName().substring(2) );
- }
-
- if (this.name != null)
- {
- this.propertyGetter = getGetterMethod(targetClass, this.name);
- this.propertySetter = getSetterMethod(targetClass, this.name);
- this.propertyType = this.propertyGetter.getGenericReturnType();
- isFieldProperty = false;
- exists = true;
- }
- else
- {
- throw new IllegalStateException("Invalid accessor method, must start with 'get' or 'is'. " +
- "Method: " + m + " in class: " + targetClass);
- }
- }
- }
- }
-
- public FieldMatcher getFieldMatcher()
- {
- return fieldMatcher;
- }
-
- public MethodMatcher getMethodMatcher()
- {
- return methodMatcher;
- }
-
- private void setupFieldProperty(Field propertyField)
- {
- this.propertyField = propertyField;
- isFieldProperty = true;
- this.name = propertyField.getName();
- this.propertyType = propertyField.getGenericType();
- }
-
- /**
- * This method sets the property value for a specified bean to the specified
- * value. The property to be set is either a field or setter method that
- * matches the specified annotation class and returns true for the isMatch()
- * method.
- *
- * @param bean The bean containing the property to set
- * @param value The new property value
- * @throws Exception
- */
- public void setValue(Object bean, Object value) throws Exception
- {
- if (isFieldProperty)
- {
- setFieldValue(propertyField, bean, value);
- }
- else
- {
- invokeMethod(propertySetter, bean, value);
- }
- }
-
- /**
- * Returns the property value for the specified bean. The property to be
- * returned is either a field or getter method that matches the specified
- * annotation class and returns true for the isMatch() method.
- *
- * @param bean The bean to read the property from
- * @return The property value
- * @throws Exception
- */
- public Object getValue(Object bean) throws Exception
- {
- if (isFieldProperty)
- {
- return getFieldValue(propertyField, bean);
- }
- else
- {
- return invokeMethod(propertyGetter, bean);
- }
- }
-
- /**
- * Returns the property type
- *
- * @return The property type
- */
- public Type getPropertyType()
- {
- return propertyType;
- }
-
- /**
- * Returns true if the property has been successfully located, otherwise
- * returns false.
- *
- * @return
- */
- public boolean exists()
- {
- return exists;
- }
-
- /**
- * Returns the name of the property. If the property is a field, then the
- * field name is returned. Otherwise, if the property is a method, then the
- * name that is returned is the getter method name without the "get" or "is"
- * prefix, and a lower case first letter.
- *
- * @return The name of the property
- */
- public String getName()
- {
- return name;
- }
-
- private Object getFieldValue(Field field, Object obj)
- {
- field.setAccessible(true);
- try
- {
- return field.get(obj);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(buildGetFieldValueErrorMessage(field, obj), e);
- }
- catch (NullPointerException ex)
- {
- NullPointerException ex2 = new NullPointerException(
- buildGetFieldValueErrorMessage(field, obj));
- ex2.initCause(ex.getCause());
- throw ex2;
- }
- }
-
- private String buildGetFieldValueErrorMessage(Field field, Object obj)
- {
- return String.format("Exception reading [%s] field from object [%s].",
- field.getName(), obj);
- }
-
- private void setFieldValue(Field field, Object obj, Object value)
- {
- field.setAccessible(true);
- try
- {
- field.set(obj, value);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(buildSetFieldValueErrorMessage(field, obj, value), e);
- }
- catch (NullPointerException ex)
- {
- NullPointerException ex2 = new NullPointerException(
- buildSetFieldValueErrorMessage(field, obj, value));
- ex2.initCause(ex.getCause());
- throw ex2;
- }
- }
-
- private String buildSetFieldValueErrorMessage(Field field, Object obj, Object value)
- {
- return String.format("Exception setting [%s] field on object [%s] to value [%s]",
- field.getName(), obj, value);
- }
-
- private Object invokeMethod(Method method, Object obj, Object... args)
- {
- try
- {
- return method.invoke(obj, args);
- }
- catch (IllegalAccessException ex)
- {
- throw new RuntimeException(buildInvokeMethodErrorMessage(method, obj, args), ex);
- }
- catch (IllegalArgumentException ex)
- {
- throw new IllegalArgumentException(buildInvokeMethodErrorMessage(method, obj, args), ex.getCause());
- }
- catch (InvocationTargetException ex)
- {
- throw new RuntimeException(buildInvokeMethodErrorMessage(method, obj, args), ex);
- }
- catch (NullPointerException ex)
- {
- NullPointerException ex2 = new NullPointerException(buildInvokeMethodErrorMessage(method, obj, args));
- ex2.initCause(ex.getCause());
- throw ex2;
- }
- catch (ExceptionInInitializerError e)
- {
- throw new RuntimeException(buildInvokeMethodErrorMessage(method, obj, args), e);
- }
- }
-
- private String buildInvokeMethodErrorMessage(Method method, Object obj, Object... args)
- {
- StringBuilder message = new StringBuilder(String.format(
- "Exception invoking method [%s] on object [%s], using arguments [",
- method.getName(), obj));
- if (args != null) for (int i = 0; i < args.length; i++) message.append((i > 0 ? "," : "") + args[i]);
- message.append("]");
- return message.toString();
- }
-
- private Method getSetterMethod(Class<?> clazz, String name)
- {
- Method[] methods = clazz.getMethods();
- for (Method method: methods)
- {
- String methodName = method.getName();
- if ( methodName.startsWith("set") && method.getParameterTypes().length==1 )
- {
- if ( Introspector.decapitalize( methodName.substring(3) ).equals(name) )
- {
- return method;
- }
- }
- }
- throw new IllegalArgumentException("no such setter method: " + clazz.getName() + '.' + name);
- }
-
- private Method getGetterMethod(Class<?> clazz, String name)
- {
- Method[] methods = clazz.getMethods();
- for (Method method: methods)
- {
- String methodName = method.getName();
- if ( method.getParameterTypes().length==0 )
- {
- if ( methodName.startsWith("get") )
- {
- if ( Introspector.decapitalize( methodName.substring(3) ).equals(name) )
- {
- return method;
- }
- }
- else if ( methodName.startsWith("is") )
- {
- if ( Introspector.decapitalize( methodName.substring(2) ).equals(name) )
- {
- return method;
- }
- }
- }
- }
- throw new IllegalArgumentException("no such getter method: " + clazz.getName() + '.' + name);
- }
-}
Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 13:58:26 UTC (rev 6370)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -1,108 +0,0 @@
-package org.jboss.weld.extensions.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-/**
- * A convenience class for working with an annotated property (either a field or
- * method) of a JavaBean class. By providing an overridden annotationMatches()
- * method in a subclass, annotations may be matched on their attribute values or
- * other conditions.
- *
- * @author Shane Bryzak
- */
-public class AnnotatedBeanProperty<T extends Annotation> extends AbstractBeanProperty
-{
- private T annotation;
-
- public interface AnnotationMatcher
- {
- boolean matches(Annotation annotation);
- }
-
- private static class DefaultAnnotationMatcher implements AnnotationMatcher
- {
- public boolean matches(Annotation annotation)
- {
- return true;
- }
- }
-
- private static final AnnotationMatcher defaultMatcher = new DefaultAnnotationMatcher();
-
- private static class AnnotatedMatcher implements FieldMatcher, MethodMatcher
- {
- private Class<? extends Annotation> annotationClass;
- private AnnotationMatcher matcher;
- private Annotation match;
-
- public AnnotatedMatcher(Class<? extends Annotation> annotationClass,
- AnnotationMatcher matcher)
- {
- this.annotationClass = annotationClass;
- this.matcher = matcher;
- }
-
- public boolean matches(Field f)
- {
- if (f.isAnnotationPresent(annotationClass) &&
- matcher.matches(f.getAnnotation(annotationClass)))
- {
- this.match = f.getAnnotation(annotationClass);
- return true;
- }
- return false;
- }
-
- public boolean matches(Method m)
- {
- if (m.isAnnotationPresent(annotationClass) &&
- matcher.matches(m.getAnnotation(annotationClass)))
- {
- this.match = m.getAnnotation(annotationClass);
- return true;
- }
- return false;
- }
-
- public Annotation getMatch()
- {
- return match;
- }
- }
-
- /**
- * Default constructor
- *
- * @param cls The class to scan for the property
- * @param annotationClass The annotation class to scan for. Specified attribute
- * values may be scanned for by providing an implementation of the isMatch() method.
- */
- @SuppressWarnings("unchecked")
- public AnnotatedBeanProperty(Class<?> cls, Class<T> annotationClass,
- AnnotationMatcher annotationMatcher)
- {
- super(cls, new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : defaultMatcher),
- new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : defaultMatcher));
-
- if (((AnnotatedMatcher) getFieldMatcher()).getMatch() != null)
- {
- this.annotation = (T) ((AnnotatedMatcher) getFieldMatcher()).getMatch();
- }
- else if (((AnnotatedMatcher) getMethodMatcher()).getMatch() != null)
- {
- this.annotation = (T) ((AnnotatedMatcher) getMethodMatcher()).getMatch();
- }
- }
-
- /**
- * Returns the annotation instance
- *
- * @return The annotation instance
- */
- public T getAnnotation()
- {
- return annotation;
- }
-}
\ No newline at end of file
Deleted: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01 13:58:26 UTC (rev 6370)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -1,43 +0,0 @@
-package org.jboss.weld.extensions.util;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-/**
- * A convenience class for working with a typed property (either a field or
- * method) of a JavaBean class.
- *
- * @author Shane Bryzak
- */
-public class TypedBeanProperty extends AbstractBeanProperty
-{
- private static class TypedMatcher implements FieldMatcher, MethodMatcher
- {
- private Class<?> propertyClass;
-
- public TypedMatcher(Class<?> propertyClass)
- {
- if (propertyClass == null)
- {
- throw new IllegalArgumentException("propertyClass can not be null.");
- }
-
- this.propertyClass = propertyClass;
- }
-
- public boolean matches(Field f)
- {
- return propertyClass.equals(f.getType());
- }
-
- public boolean matches(Method m)
- {
- return propertyClass.equals(m.getReturnType());
- }
- }
-
- public TypedBeanProperty(Class<?> cls, Class<?> propertyClass)
- {
- super(cls, new TypedMatcher(propertyClass), new TypedMatcher(propertyClass));
- }
-}
Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AbstractBeanProperty.java (from rev 6370, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AbstractBeanProperty.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AbstractBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,112 @@
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * Base class for bean property wrappers. Non-deterministic in the case their
+ * are multiple annotated properties.
+ *
+ * Threadsafe.
+ *
+ * @author Shane Bryzak
+ */
+public class AbstractBeanProperty<V>
+{
+
+ static class Matched<T>
+ {
+
+ private T matched;
+
+ void setMatched(T matched)
+ {
+ this.matched = matched;
+ }
+
+ T getMatched()
+ {
+ return matched;
+ }
+
+ }
+
+ /**
+ * Subclasses should provide an implementation of FieldMatcher to determine
+ * whether a Field contains the bean property
+ */
+ static interface FieldMatcher
+ {
+ boolean matches(Field field);
+ }
+
+ /**
+ * Subclasses should provide an implementation of MethodMatcher to determine
+ * whether a method provides the bean property
+ */
+ static interface MethodMatcher
+ {
+ boolean matches(Method method);
+ }
+
+ /**
+ * Property field
+ */
+ private final Property<V> property;
+
+ /**
+ *
+ * @param targetClass
+ */
+ public AbstractBeanProperty(Class<?> targetClass, FieldMatcher fieldMatcher, MethodMatcher methodMatcher)
+ {
+
+ // First check declared fields
+ for (Field field : targetClass.getDeclaredFields())
+ {
+ if (fieldMatcher.matches(field))
+ {
+ this.property = Properties.createProperty(field);
+ return;
+ }
+ }
+
+ // Then check public fields, in case it's inherited
+ for (Field field : targetClass.getFields())
+ {
+ if (fieldMatcher.matches(field))
+ {
+ this.property = Properties.createProperty(field);
+ return;
+ }
+ }
+
+ // Then check public methods (we ignore private methods)
+ for (Method method : targetClass.getMethods())
+ {
+ if (methodMatcher.matches(method))
+ {
+ this.property = Properties.createProperty(method);
+ return;
+ }
+ }
+ this.property = null;
+ }
+
+ /**
+ * Returns true if the property has been successfully located, otherwise
+ * returns false.
+ *
+ * @return
+ */
+ public boolean exists()
+ {
+ return property != null;
+ }
+
+ public Property<V> getProperty()
+ {
+ return property;
+ }
+
+}
Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AnnotatedBeanProperty.java (from rev 6370, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AnnotatedBeanProperty.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/AnnotatedBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,63 @@
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+
+/**
+ * A convenience class for working with an annotated property (either a field or
+ * method) of a JavaBean class.
+ *
+ * @author Shane Bryzak
+ * @author Pete Muir
+ */
+public class AnnotatedBeanProperty<V> extends AbstractBeanProperty<V>
+{
+
+ /**
+ * An {@link AnnotatedElement} based matcher
+ *
+ * @author pmuir
+ *
+ */
+ public interface AnnotationMatcher
+ {
+ boolean matches(AnnotatedElement element);
+ }
+
+ private static class AnnotationMatcherAdapter implements FieldMatcher, MethodMatcher
+ {
+ private final AnnotationMatcher matcher;
+
+ public AnnotationMatcherAdapter(AnnotationMatcher matcher)
+ {
+ if (matcher == null)
+ {
+ throw new IllegalArgumentException("matcher must not be null");
+ }
+ this.matcher = matcher;
+ }
+
+ public boolean matches(Field f)
+ {
+ return matcher.matches(f);
+ }
+
+ public boolean matches(Method m)
+ {
+ return matcher.matches(m);
+ }
+ }
+
+ public AnnotatedBeanProperty(Class<?> targetClass, AnnotationMatcher annotationMatcher)
+ {
+ this(targetClass, new AnnotationMatcherAdapter(annotationMatcher));
+ }
+
+ private AnnotatedBeanProperty(Class<?> targetClass, AnnotationMatcherAdapter matcher)
+ {
+ super(targetClass, matcher, matcher);
+ }
+
+}
\ No newline at end of file
Added: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldProperty.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+
+class FieldProperty<V> implements Property<V>
+{
+
+
+ private static String buildGetFieldValueErrorMessage(Field field, Object obj)
+ {
+ return String.format("Exception reading [%s] field from object [%s].", field.getName(), obj);
+ }
+
+ private static String buildSetFieldValueErrorMessage(Field field, Object obj, Object value)
+ {
+ return String.format("Exception setting [%s] field on object [%s] to value [%s]", field.getName(), obj, value);
+ }
+
+ private final Field field;
+
+ FieldProperty(Field field)
+ {
+ this.field = field;
+ }
+
+ public String getName()
+ {
+ return field.getName();
+ }
+
+ public Type getBaseType()
+ {
+ return field.getGenericType();
+ }
+
+ public Field getAnnotatedElement()
+ {
+ return field;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<V> getJavaClass()
+ {
+ return (Class<V>) field.getType();
+ }
+
+ public V getValue(Object instance)
+ {
+ field.setAccessible(true);
+ try
+ {
+ return getJavaClass().cast(field.get(instance));
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(buildGetFieldValueErrorMessage(field, instance), e);
+ }
+ catch (NullPointerException ex)
+ {
+ NullPointerException ex2 = new NullPointerException(buildGetFieldValueErrorMessage(field, instance));
+ ex2.initCause(ex.getCause());
+ throw ex2;
+ }
+ }
+
+ public void setValue(Object instance, V value)
+ {
+ field.setAccessible(true);
+ try
+ {
+ field.set(instance, value);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(buildSetFieldValueErrorMessage(field, instance, value), e);
+ }
+ catch (NullPointerException ex)
+ {
+ NullPointerException ex2 = new NullPointerException(buildSetFieldValueErrorMessage(field, instance, value));
+ ex2.initCause(ex.getCause());
+ throw ex2;
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/FieldProperty.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodProperty.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,151 @@
+/**
+ *
+ */
+package org.jboss.weld.extensions.util.properties;
+
+import java.beans.Introspector;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+class MethodProperty<V> implements Property<V>
+{
+
+ private static String buildInvokeMethodErrorMessage(Method method, Object obj, Object... args)
+ {
+ StringBuilder message = new StringBuilder(String.format("Exception invoking method [%s] on object [%s], using arguments [", method.getName(), obj));
+ if (args != null)
+ for (int i = 0; i < args.length; i++)
+ message.append((i > 0 ? "," : "") + args[i]);
+ message.append("]");
+ return message.toString();
+ }
+
+ private static Object invokeMethod(Method method, Object obj, Object... args)
+ {
+ try
+ {
+ return method.invoke(obj, args);
+ }
+ catch (IllegalAccessException ex)
+ {
+ throw new RuntimeException(buildInvokeMethodErrorMessage(method, obj, args), ex);
+ }
+ catch (IllegalArgumentException ex)
+ {
+ throw new IllegalArgumentException(buildInvokeMethodErrorMessage(method, obj, args), ex.getCause());
+ }
+ catch (InvocationTargetException ex)
+ {
+ throw new RuntimeException(buildInvokeMethodErrorMessage(method, obj, args), ex);
+ }
+ catch (NullPointerException ex)
+ {
+ NullPointerException ex2 = new NullPointerException(buildInvokeMethodErrorMessage(method, obj, args));
+ ex2.initCause(ex.getCause());
+ throw ex2;
+ }
+ catch (ExceptionInInitializerError e)
+ {
+ throw new RuntimeException(buildInvokeMethodErrorMessage(method, obj, args), e);
+ }
+ }
+
+ private static Method getSetterMethod(Class<?> clazz, String name)
+ {
+ Method[] methods = clazz.getMethods();
+ for (Method method : methods)
+ {
+ String methodName = method.getName();
+ if (methodName.startsWith("set") && method.getParameterTypes().length == 1)
+ {
+ if (Introspector.decapitalize(methodName.substring(3)).equals(name))
+ {
+ return method;
+ }
+ }
+ }
+ throw new IllegalArgumentException("no such setter method: " + clazz.getName() + '.' + name);
+ }
+
+ private static Method getGetterMethod(Class<?> clazz, String name)
+ {
+ for (Method method : clazz.getDeclaredMethods())
+ {
+ String methodName = method.getName();
+ if (method.getParameterTypes().length == 0)
+ {
+ if (methodName.startsWith("get"))
+ {
+ if (Introspector.decapitalize(methodName.substring(3)).equals(name))
+ {
+ return method;
+ }
+ }
+ else if (methodName.startsWith("is"))
+ {
+ if (Introspector.decapitalize(methodName.substring(2)).equals(name))
+ {
+ return method;
+ }
+ }
+ }
+ }
+ throw new IllegalArgumentException("no such getter method: " + clazz.getName() + '.' + name);
+ }
+
+ private final Method getterMethod;
+ private final String propertyName;
+ private final Method setterMethod;
+
+ MethodProperty(Method method)
+ {
+ if (method.getName().startsWith("get"))
+ {
+ this.propertyName = Introspector.decapitalize(method.getName().substring(3));
+ }
+ else if (method.getName().startsWith("is"))
+ {
+ this.propertyName = Introspector.decapitalize(method.getName().substring(2));
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid accessor method, must start with 'get' or 'is'. " + "Method: " + method);
+ }
+ this.getterMethod = getGetterMethod(method.getDeclaringClass(), propertyName);
+ this.setterMethod = getSetterMethod(method.getDeclaringClass(), propertyName);
+
+ }
+
+ public String getName()
+ {
+ return propertyName;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<V> getJavaClass()
+ {
+ return (Class<V>) getterMethod.getReturnType();
+ }
+
+ public Type getBaseType()
+ {
+ return getterMethod.getGenericReturnType();
+ }
+
+ public Method getAnnotatedElement()
+ {
+ return getterMethod;
+ }
+
+ public V getValue(Object instance)
+ {
+ return getJavaClass().cast(invokeMethod(getterMethod, instance));
+ }
+
+ public void setValue(Object instance, V value)
+ {
+ invokeMethod(setterMethod, instance, value);
+ }
+
+}
\ No newline at end of file
Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/MethodProperty.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Properties.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Properties.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Properties.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,42 @@
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * Utility class for working with JavaBean style properties
+ *
+ * @author pmuir
+ *
+ */
+public class Properties
+{
+
+ private Properties() {}
+
+ /**
+ * Create a JavaBean style property from the field
+ *
+ * @param <V>
+ * @param field
+ * @return
+ */
+ public static <V> Property<V> createProperty(Field field)
+ {
+ return new FieldProperty<V>(field);
+ }
+
+ /**
+ * Create a JavaBean style property from the specified method
+ *
+ * @param <V>
+ * @param method
+ * @return
+ * @throws IllegalArgumentException if the method does not match JavaBean conventions
+ */
+ public static <V> Property<V> createProperty(Method method)
+ {
+ return new MethodProperty<V>(method);
+ }
+
+}
Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Properties.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,62 @@
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Type;
+
+/**
+ * A representation of a JavaBean style property
+ *
+ * @see Properties
+ *
+ * @author pmuir
+ *
+ * @param <V>
+ */
+public interface Property<V>
+{
+
+ /**
+ * Returns the name of the property. If the property is a field, then the
+ * field name is returned. Otherwise, if the property is a method, then the
+ * name that is returned is the getter method name without the "get" or "is"
+ * prefix, and a lower case first letter.
+ *
+ * @return The name of the property
+ */
+ public String getName();
+
+ /**
+ * Returns the property type
+ *
+ * @return The property type
+ */
+ public Type getBaseType();
+
+ /**
+ * Returns the property type
+ *
+ * @return The property type
+ */
+ public Class<V> getJavaClass();
+
+ public AnnotatedElement getAnnotatedElement();
+
+ /**
+ * Returns the property value for the specified bean. The property to be
+ * returned is either a field or getter method.
+ *
+ * @param bean The bean to read the property from
+ * @return The property value
+ */
+ public V getValue(Object instance);
+
+ /**
+ * This method sets the property value for a specified bean to the specified
+ * value. The property to be set is either a field or setter method.
+ *
+ * @param bean The bean containing the property to set
+ * @param value The new property value
+ */
+ public void setValue(Object instance, V value);
+
+}
\ No newline at end of file
Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/Property.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypeAnnotatedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypeAnnotatedBeanProperty.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypeAnnotatedBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,72 @@
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+public class TypeAnnotatedBeanProperty<T extends Annotation, V> extends AnnotatedBeanProperty<V>
+{
+
+
+ /**
+ * An AnnotationMatcher which simply requires the the annotation to be of the
+ * specified type
+ *
+ */
+ private static class TypeAnnotationMatcher<T extends Annotation> implements AnnotationMatcher
+ {
+
+ private final Class<T> annotationType;
+
+ private final Matched<T> matched;
+
+ public TypeAnnotationMatcher(Class<T> annotationType, Matched<T> matched)
+ {
+ if (annotationType == null)
+ {
+ throw new IllegalArgumentException("annotationType must not be null");
+ }
+ this.annotationType = annotationType;
+ this.matched = matched;
+ }
+
+ public boolean matches(AnnotatedElement element)
+ {
+ if (element.isAnnotationPresent(annotationType))
+ {
+ this.matched.setMatched(element.getAnnotation(annotationType));
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ private final T annotation;
+
+ /**
+ * Default constructor
+ *
+ * @param cls The class to scan for the property
+ * @param annotationClass The annotation class to scan for. Specified
+ * attribute values may be scanned for by providing an
+ * implementation of the isMatch() method.
+ */
+ public TypeAnnotatedBeanProperty(Class<?> cls, Class<T> annotationType)
+ {
+ this(cls, annotationType, new Matched<T>());
+ }
+
+ private TypeAnnotatedBeanProperty(Class<?> targetClass, Class<T> annotationType, Matched<T> matched)
+ {
+ super(targetClass, new TypeAnnotationMatcher<T>(annotationType, matched));
+ this.annotation = matched.getMatched();
+ }
+
+ public T getAnnotation()
+ {
+ return annotation;
+ }
+
+}
Property changes on: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypeAnnotatedBeanProperty.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypedBeanProperty.java (from rev 6370, extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypedBeanProperty.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/properties/TypedBeanProperty.java 2010-06-01 16:34:09 UTC (rev 6371)
@@ -0,0 +1,44 @@
+package org.jboss.weld.extensions.util.properties;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+
+/**
+ * A convenience class for working with a typed property (either a field or
+ * method) of a JavaBean class.
+ *
+ * @author Shane Bryzak
+ */
+public class TypedBeanProperty<V> extends AbstractBeanProperty<V>
+{
+ private static class TypedMatcher<V> implements FieldMatcher, MethodMatcher
+ {
+ private Class<V> propertyClass;
+
+ public TypedMatcher(Class<V> propertyClass)
+ {
+ if (propertyClass == null)
+ {
+ throw new IllegalArgumentException("propertyClass can not be null.");
+ }
+
+ this.propertyClass = propertyClass;
+ }
+
+ public boolean matches(Field f)
+ {
+ return propertyClass.equals(f.getType());
+ }
+
+ public boolean matches(Method m)
+ {
+ return propertyClass.equals(m.getReturnType());
+ }
+ }
+
+ public TypedBeanProperty(Class<?> targetClass, Class<V> propertyClass)
+ {
+ super(targetClass, new TypedMatcher<V>(propertyClass), new TypedMatcher<V>(propertyClass));
+ }
+}
14 years, 5 months
Weld SVN: r6370 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-06-01 09:58:26 -0400 (Tue, 01 Jun 2010)
New Revision: 6370
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
Log:
minor
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 13:55:09 UTC (rev 6369)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 13:58:26 UTC (rev 6370)
@@ -29,6 +29,8 @@
}
}
+ private static final AnnotationMatcher defaultMatcher = new DefaultAnnotationMatcher();
+
private static class AnnotatedMatcher implements FieldMatcher, MethodMatcher
{
private Class<? extends Annotation> annotationClass;
@@ -81,8 +83,8 @@
public AnnotatedBeanProperty(Class<?> cls, Class<T> annotationClass,
AnnotationMatcher annotationMatcher)
{
- super(cls, new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()),
- new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()));
+ super(cls, new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : defaultMatcher),
+ new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : defaultMatcher));
if (((AnnotatedMatcher) getFieldMatcher()).getMatch() != null)
{
14 years, 5 months
Weld SVN: r6369 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-06-01 09:55:09 -0400 (Tue, 01 Jun 2010)
New Revision: 6369
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java
Log:
renamed isValid() -> exists()
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java 2010-06-01 12:01:55 UTC (rev 6368)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java 2010-06-01 13:55:09 UTC (rev 6369)
@@ -57,9 +57,9 @@
private boolean isFieldProperty;
/**
- * Flag indicating whether a valid property has been found
+ * Flag indicating whether the property exists
*/
- private boolean valid = false;
+ private boolean exists = false;
private Type propertyType;
@@ -83,7 +83,7 @@
if (fieldMatcher.matches(f))
{
setupFieldProperty(f);
- valid = true;
+ exists = true;
return;
}
}
@@ -94,7 +94,7 @@
if (fieldMatcher.matches(f))
{
setupFieldProperty(f);
- valid = true;
+ exists = true;
return;
}
}
@@ -121,7 +121,7 @@
this.propertySetter = getSetterMethod(targetClass, this.name);
this.propertyType = this.propertyGetter.getGenericReturnType();
isFieldProperty = false;
- valid = true;
+ exists = true;
}
else
{
@@ -209,9 +209,9 @@
*
* @return
*/
- public boolean isValid()
+ public boolean exists()
{
- return valid;
+ return exists;
}
/**
14 years, 5 months
Weld SVN: r6368 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-06-01 08:01:55 -0400 (Tue, 01 Jun 2010)
New Revision: 6368
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
Log:
minor
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 11:51:42 UTC (rev 6367)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 12:01:55 UTC (rev 6368)
@@ -21,7 +21,7 @@
boolean matches(Annotation annotation);
}
- public static class DefaultAnnotationMatcher implements AnnotationMatcher
+ private static class DefaultAnnotationMatcher implements AnnotationMatcher
{
public boolean matches(Annotation annotation)
{
@@ -29,13 +29,13 @@
}
}
- private static class AnnotatedFieldMatcher implements FieldMatcher
+ private static class AnnotatedMatcher implements FieldMatcher, MethodMatcher
{
private Class<? extends Annotation> annotationClass;
private AnnotationMatcher matcher;
private Annotation match;
- public AnnotatedFieldMatcher(Class<? extends Annotation> annotationClass,
+ public AnnotatedMatcher(Class<? extends Annotation> annotationClass,
AnnotationMatcher matcher)
{
this.annotationClass = annotationClass;
@@ -53,25 +53,6 @@
return false;
}
- public Annotation getMatch()
- {
- return match;
- }
- }
-
- private static class AnnotatedMethodMatcher implements MethodMatcher
- {
- private Class<? extends Annotation> annotationClass;
- private AnnotationMatcher matcher;
- private Annotation match;
-
- public AnnotatedMethodMatcher(Class<? extends Annotation> annotationClass,
- AnnotationMatcher matcher)
- {
- this.annotationClass = annotationClass;
- this.matcher = matcher;
- }
-
public boolean matches(Method m)
{
if (m.isAnnotationPresent(annotationClass) &&
@@ -81,7 +62,7 @@
return true;
}
return false;
- }
+ }
public Annotation getMatch()
{
@@ -100,16 +81,16 @@
public AnnotatedBeanProperty(Class<?> cls, Class<T> annotationClass,
AnnotationMatcher annotationMatcher)
{
- super(cls, new AnnotatedFieldMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()),
- new AnnotatedMethodMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()));
+ super(cls, new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()),
+ new AnnotatedMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()));
- if (((AnnotatedFieldMatcher) getFieldMatcher()).getMatch() != null)
+ if (((AnnotatedMatcher) getFieldMatcher()).getMatch() != null)
{
- this.annotation = (T) ((AnnotatedFieldMatcher) getFieldMatcher()).getMatch();
+ this.annotation = (T) ((AnnotatedMatcher) getFieldMatcher()).getMatch();
}
- else if (((AnnotatedMethodMatcher) getMethodMatcher()).getMatch() != null)
+ else if (((AnnotatedMatcher) getMethodMatcher()).getMatch() != null)
{
- this.annotation = (T) ((AnnotatedMethodMatcher) getMethodMatcher()).getMatch();
+ this.annotation = (T) ((AnnotatedMatcher) getMethodMatcher()).getMatch();
}
}
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01 11:51:42 UTC (rev 6367)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01 12:01:55 UTC (rev 6368)
@@ -11,11 +11,11 @@
*/
public class TypedBeanProperty extends AbstractBeanProperty
{
- private static class TypedFieldMatcher implements FieldMatcher
+ private static class TypedMatcher implements FieldMatcher, MethodMatcher
{
private Class<?> propertyClass;
- public TypedFieldMatcher(Class<?> propertyClass)
+ public TypedMatcher(Class<?> propertyClass)
{
if (propertyClass == null)
{
@@ -29,30 +29,15 @@
{
return propertyClass.equals(f.getType());
}
- }
-
- private static class TypedMethodMatcher implements MethodMatcher
- {
- private Class<?> propertyClass;
- public TypedMethodMatcher(Class<?> propertyClass)
- {
- if (propertyClass == null)
- {
- throw new IllegalArgumentException("propertyClass can not be null.");
- }
-
- this.propertyClass = propertyClass;
- }
-
public boolean matches(Method m)
{
return propertyClass.equals(m.getReturnType());
- }
+ }
}
public TypedBeanProperty(Class<?> cls, Class<?> propertyClass)
{
- super(cls, new TypedFieldMatcher(propertyClass), new TypedMethodMatcher(propertyClass));
+ super(cls, new TypedMatcher(propertyClass), new TypedMatcher(propertyClass));
}
}
14 years, 5 months
Weld SVN: r6367 - extensions/trunk/src/main/java/org/jboss/weld/extensions/util.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-06-01 07:51:42 -0400 (Tue, 01 Jun 2010)
New Revision: 6367
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
Log:
refactor bean property util classes to do work in constructor
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java 2010-06-01 09:56:01 UTC (rev 6366)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AbstractBeanProperty.java 2010-06-01 11:51:42 UTC (rev 6367)
@@ -11,9 +11,27 @@
*
* @author Shane Bryzak
*/
-public abstract class AbstractBeanProperty
+public class AbstractBeanProperty
{
/**
+ * Subclasses should provide an implementation of FieldMatcher to determine
+ * whether a Field contains the bean property
+ */
+ interface FieldMatcher
+ {
+ boolean matches(Field f);
+ }
+
+ /**
+ * Subclasses should provide an implementation of MethodMatcher to determine
+ * whether a method provides the bean property
+ */
+ interface MethodMatcher
+ {
+ boolean matches(Method m);
+ }
+
+ /**
* Property field
*/
private Field propertyField;
@@ -31,18 +49,11 @@
/**
* Property name
*/
- private String name;
+ private String name;
/**
- * The class containing the property
+ * Flag indicating whether the bean property value is contained in a field
*/
- private Class<?> targetClass;
-
- /**
- * Flag indicating whether the target class has been scanned
- */
- private boolean scanned = false;
-
private boolean isFieldProperty;
/**
@@ -50,27 +61,26 @@
*/
private boolean valid = false;
- private Type propertyType;
+ private Type propertyType;
+ private FieldMatcher fieldMatcher;
+
+ private MethodMatcher methodMatcher;
+
/**
*
* @param targetClass
*/
- public AbstractBeanProperty(Class<?> targetClass)
+ public AbstractBeanProperty(Class<?> targetClass, FieldMatcher fieldMatcher,
+ MethodMatcher methodMatcher)
{
- this.targetClass = targetClass;
- }
-
- protected void scan()
- {
- if (scanned) return;
+ this.fieldMatcher = fieldMatcher;
+ this.methodMatcher = methodMatcher;
- scanned = true;
-
// First check declared fields
for (Field f : targetClass.getDeclaredFields())
{
- if (fieldMatches(f))
+ if (fieldMatcher.matches(f))
{
setupFieldProperty(f);
valid = true;
@@ -81,7 +91,7 @@
// Then check public fields, in case it's inherited
for (Field f : targetClass.getFields())
{
- if (fieldMatches(f))
+ if (fieldMatcher.matches(f))
{
setupFieldProperty(f);
valid = true;
@@ -92,7 +102,7 @@
// Then check public methods (we ignore private methods)
for (Method m : targetClass.getMethods())
{
- if (methodMatches(m))
+ if (methodMatcher.matches(m))
{
String methodName = m.getName();
@@ -119,12 +129,18 @@
"Method: " + m + " in class: " + targetClass);
}
}
- }
+ }
}
- protected abstract boolean fieldMatches(Field f);
+ public FieldMatcher getFieldMatcher()
+ {
+ return fieldMatcher;
+ }
- protected abstract boolean methodMatches(Method m);
+ public MethodMatcher getMethodMatcher()
+ {
+ return methodMatcher;
+ }
private void setupFieldProperty(Field propertyField)
{
@@ -146,8 +162,6 @@
*/
public void setValue(Object bean, Object value) throws Exception
{
- scan();
-
if (isFieldProperty)
{
setFieldValue(propertyField, bean, value);
@@ -169,8 +183,6 @@
*/
public Object getValue(Object bean) throws Exception
{
- scan();
-
if (isFieldProperty)
{
return getFieldValue(propertyField, bean);
@@ -188,7 +200,6 @@
*/
public Type getPropertyType()
{
- scan();
return propertyType;
}
@@ -200,7 +211,6 @@
*/
public boolean isValid()
{
- scan();
return valid;
}
@@ -213,8 +223,7 @@
* @return The name of the property
*/
public String getName()
- {
- scan();
+ {
return name;
}
@@ -240,7 +249,7 @@
private String buildGetFieldValueErrorMessage(Field field, Object obj)
{
- return String.format("Exception reading [%s] field from object [%s].",
+ return String.format("Exception reading [%s] field from object [%s].",
field.getName(), obj);
}
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 09:56:01 UTC (rev 6366)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01 11:51:42 UTC (rev 6367)
@@ -14,76 +14,112 @@
*/
public class AnnotatedBeanProperty<T extends Annotation> extends AbstractBeanProperty
{
- private T annotation;
+ private T annotation;
- private Class<T> annotationClass;
+ public interface AnnotationMatcher
+ {
+ boolean matches(Annotation annotation);
+ }
- /**
- * Default constructor
- *
- * @param cls The class to scan for the property
- * @param annotationClass The annotation class to scan for. Specified attribute
- * values may be scanned for by providing an implementation of the isMatch() method.
- */
- public AnnotatedBeanProperty(Class<?> cls, Class<T> annotationClass)
- {
- super(cls);
- this.annotationClass = annotationClass;
- }
+ public static class DefaultAnnotationMatcher implements AnnotationMatcher
+ {
+ public boolean matches(Annotation annotation)
+ {
+ return true;
+ }
+ }
- protected boolean fieldMatches(Field f)
+ private static class AnnotatedFieldMatcher implements FieldMatcher
{
- if (f.isAnnotationPresent(annotationClass) &&
- annotationMatches(f.getAnnotation(annotationClass)))
- {
- this.annotation = f.getAnnotation(annotationClass);
- return true;
+ private Class<? extends Annotation> annotationClass;
+ private AnnotationMatcher matcher;
+ private Annotation match;
+
+ public AnnotatedFieldMatcher(Class<? extends Annotation> annotationClass,
+ AnnotationMatcher matcher)
+ {
+ this.annotationClass = annotationClass;
+ this.matcher = matcher;
}
- else
+
+ public boolean matches(Field f)
{
+ if (f.isAnnotationPresent(annotationClass) &&
+ matcher.matches(f.getAnnotation(annotationClass)))
+ {
+ this.match = f.getAnnotation(annotationClass);
+ return true;
+ }
return false;
}
+
+ public Annotation getMatch()
+ {
+ return match;
+ }
}
- protected boolean methodMatches(Method m)
+ private static class AnnotatedMethodMatcher implements MethodMatcher
{
- if (m.isAnnotationPresent(annotationClass) &&
- annotationMatches(m.getAnnotation(annotationClass)))
+ private Class<? extends Annotation> annotationClass;
+ private AnnotationMatcher matcher;
+ private Annotation match;
+
+ public AnnotatedMethodMatcher(Class<? extends Annotation> annotationClass,
+ AnnotationMatcher matcher)
{
- this.annotation = m.getAnnotation(annotationClass);
- return true;
+ this.annotationClass = annotationClass;
+ this.matcher = matcher;
}
- else
+
+ public boolean matches(Method m)
{
+ if (m.isAnnotationPresent(annotationClass) &&
+ matcher.matches(m.getAnnotation(annotationClass)))
+ {
+ this.match = m.getAnnotation(annotationClass);
+ return true;
+ }
return false;
}
+
+ public Annotation getMatch()
+ {
+ return match;
+ }
}
/**
- * This method may be overridden by a subclass. It can be used to scan
- * for an annotation with particular attribute values, or to allow a match
- * based on more complex logic.
+ * Default constructor
*
- * @param annotation The potential match
- * @return true if the specified annotation is a match
+ * @param cls The class to scan for the property
+ * @param annotationClass The annotation class to scan for. Specified attribute
+ * values may be scanned for by providing an implementation of the isMatch() method.
*/
- protected boolean annotationMatches(T annotation)
- {
- return true;
- }
+ @SuppressWarnings("unchecked")
+ public AnnotatedBeanProperty(Class<?> cls, Class<T> annotationClass,
+ AnnotationMatcher annotationMatcher)
+ {
+ super(cls, new AnnotatedFieldMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()),
+ new AnnotatedMethodMatcher(annotationClass, annotationMatcher != null ? annotationMatcher : new DefaultAnnotationMatcher()));
+
+ if (((AnnotatedFieldMatcher) getFieldMatcher()).getMatch() != null)
+ {
+ this.annotation = (T) ((AnnotatedFieldMatcher) getFieldMatcher()).getMatch();
+ }
+ else if (((AnnotatedMethodMatcher) getMethodMatcher()).getMatch() != null)
+ {
+ this.annotation = (T) ((AnnotatedMethodMatcher) getMethodMatcher()).getMatch();
+ }
+ }
/**
- * Returns the annotation type
+ * Returns the annotation instance
*
- * @return The annotation type
+ * @return The annotation instance
*/
public T getAnnotation()
{
- scan();
return annotation;
- }
-
-
-
-
+ }
}
\ No newline at end of file
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01 09:56:01 UTC (rev 6366)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01 11:51:42 UTC (rev 6367)
@@ -10,30 +10,49 @@
* @author Shane Bryzak
*/
public class TypedBeanProperty extends AbstractBeanProperty
-{
- private Class<?> propertyClass;
-
- public TypedBeanProperty(Class<?> cls, Class<?> propertyClass)
- {
- super(cls);
+{
+ private static class TypedFieldMatcher implements FieldMatcher
+ {
+ private Class<?> propertyClass;
- if (propertyClass == null)
+ public TypedFieldMatcher(Class<?> propertyClass)
{
- throw new IllegalArgumentException("propertyClass can not be null.");
+ if (propertyClass == null)
+ {
+ throw new IllegalArgumentException("propertyClass can not be null.");
+ }
+
+ this.propertyClass = propertyClass;
}
- this.propertyClass = propertyClass;
+ public boolean matches(Field f)
+ {
+ return propertyClass.equals(f.getType());
+ }
}
-
- @Override
- protected boolean fieldMatches(Field f)
+
+ private static class TypedMethodMatcher implements MethodMatcher
{
- return propertyClass.equals(f.getType());
+ private Class<?> propertyClass;
+
+ public TypedMethodMatcher(Class<?> propertyClass)
+ {
+ if (propertyClass == null)
+ {
+ throw new IllegalArgumentException("propertyClass can not be null.");
+ }
+
+ this.propertyClass = propertyClass;
+ }
+
+ public boolean matches(Method m)
+ {
+ return propertyClass.equals(m.getReturnType());
+ }
}
-
- @Override
- protected boolean methodMatches(Method m)
- {
- return propertyClass.equals(m.getReturnType());
- }
+
+ public TypedBeanProperty(Class<?> cls, Class<?> propertyClass)
+ {
+ super(cls, new TypedFieldMatcher(propertyClass), new TypedMethodMatcher(propertyClass));
+ }
}
14 years, 5 months
Weld SVN: r6366 - api/trunk/bom.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-01 05:56:01 -0400 (Tue, 01 Jun 2010)
New Revision: 6366
Modified:
api/trunk/bom/pom.xml
Log:
WELD-489
Modified: api/trunk/bom/pom.xml
===================================================================
--- api/trunk/bom/pom.xml 2010-06-01 09:46:33 UTC (rev 6365)
+++ api/trunk/bom/pom.xml 2010-06-01 09:56:01 UTC (rev 6366)
@@ -83,6 +83,7 @@
<jta.api.version>1.1</jta.api.version>
<jms.api.version>1.1</jms.api.version>
<uel.api.version>2.2</uel.api.version>
+ <!-- Stick with JSF API 1.2 to preserve backwards compatibility with JSF 1.2 - we don't need any JSF 2 features -->
<jsf.api.version>1.2_13</jsf.api.version>
<jaxws.api.version>2.1</jaxws.api.version>
<interceptor.api.version>1.1</interceptor.api.version>
14 years, 5 months
Weld SVN: r6365 - build/trunk/parent.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-01 05:46:33 -0400 (Tue, 01 Jun 2010)
New Revision: 6365
Modified:
build/trunk/parent/pom.xml
Log:
improvements for distribution
Modified: build/trunk/parent/pom.xml
===================================================================
--- build/trunk/parent/pom.xml 2010-06-01 09:37:58 UTC (rev 6364)
+++ build/trunk/parent/pom.xml 2010-06-01 09:46:33 UTC (rev 6365)
@@ -1,4 +1,5 @@
-<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/maven-v4_0_0.xsd">
+<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-parent</artifactId>
@@ -238,12 +239,21 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- <finalName>${project.build.finalName}</finalName>
- </configuration>
+ <executions>
+ <execution>
+ <id>distribution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
+ </descriptors>
+ <finalName>${project.build.finalName}-${project.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -442,7 +452,8 @@
<configuration>
<!-- Delete this block to have Jetty run default port (8080) -->
<connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <connector
+ implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9090</port>
</connector>
</connectors>
@@ -543,7 +554,6 @@
</build>
<profiles>
- <!-- The release profile -->
<profile>
<id>release</id>
<activation>
@@ -602,6 +612,15 @@
</profile>
<profile>
<id>distribution</id>
+ <activation>
+ <property>
+ <name>dist</name>
+ </property>
+ </activation>
+ <properties>
+ <!-- Skip failing tests when building dist -->
+ <maven.test.failure.ignore>true</maven.test.failure.ignore>
+ </properties>
<build>
<plugins>
<plugin>
@@ -612,11 +631,18 @@
<id>javadoc</id>
<phase>package</phase>
<goals>
- <goal>javadoc</goal>
+ <goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>${maven.deploy.skip}</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
</profile>
14 years, 5 months
Weld SVN: r6364 - in cdi-tck/branches/1.0/doc/reference: src and 2 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-01 05:37:58 -0400 (Tue, 01 Jun 2010)
New Revision: 6364
Added:
cdi-tck/branches/1.0/doc/reference/src/
cdi-tck/branches/1.0/doc/reference/src/main/
cdi-tck/branches/1.0/doc/reference/src/main/docbook/
cdi-tck/branches/1.0/doc/reference/src/main/docbook/en-US/
Removed:
cdi-tck/branches/1.0/doc/reference/en-US/
Log:
standard location for docbook sources
Copied: cdi-tck/branches/1.0/doc/reference/src/main/docbook/en-US (from rev 6363, cdi-tck/branches/1.0/doc/reference/en-US)
14 years, 5 months