commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1070178 [1/2] - in /commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations: ./ addressbook/ catalog/ employee/ failingtetst/ person/ rss/ servletbean/
Date Sun, 13 Feb 2011 01:49:46 GMT
Author: simonetripodi
Date: Sun Feb 13 01:49:45 2011
New Revision: 1070178

URL: http://svn.apache.org/viewvc?rev=1070178&view=rev
Log:
first checkin of adapted version of 'annotations' TestCases package from /trunk
old tests continue working!

Added:
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/rss/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/rss/Channel.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/rss/Image.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/rss/Item.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/rss/RssTestCase.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/servletbean/
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/servletbean/ServletBean.java   (with props)
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/servletbean/ServletBeanTestCase.java   (with props)

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,65 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations;
+
+import static org.apache.commons.digester3.DigesterLoader.newLoader;
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.commons.digester3.Digester;
+import org.apache.commons.digester3.RulesModule;
+
+/**
+ * Abstract implementation of Class->Digester Rules->parse & confronting.
+ */
+public abstract class AbstractAnnotatedPojoTestCase {
+
+    /**
+     * Loads the digester rules parsing the expected object class, parses the
+     * XML and verify the digester produces the same result.
+     *
+     * @param expected the expected object
+     * @throws Exception if any error occurs
+     */
+    public final void verifyExpectedEqualsToParsed(Object expected) throws Exception {
+        Class<?> clazz = expected.getClass();
+
+        String resource = clazz.getSimpleName() + ".xml";
+        InputStream input = clazz.getResourceAsStream(resource);
+
+        Collection<RulesModule> modules = this.getAuxModules();
+        modules.add(new FromAnnotationsRuleModule(clazz));
+
+        Digester digester = newLoader(modules).newDigester();
+        Object actual = digester.parse(input);
+
+        if (input != null) {
+            input.close();
+        }
+
+        assertEquals(expected, actual);
+    }
+
+    protected Collection<RulesModule> getAuxModules() {
+        return new ArrayList<RulesModule>();
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/AbstractAnnotatedPojoTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,156 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.addressbook;
+
+import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "address-book/person/address")
+public class Address {
+
+    @BeanPropertySetter(pattern = "address-book/person/address/type")
+    private String type;
+
+    @BeanPropertySetter(pattern = "address-book/person/address/street")
+    private String street;
+
+    @BeanPropertySetter(pattern = "address-book/person/address/city")
+    private String city;
+
+    @BeanPropertySetter(pattern = "address-book/person/address/state")
+    private String state;
+
+    @BeanPropertySetter(pattern = "address-book/person/address/zip")
+    private String zip;
+
+    @BeanPropertySetter(pattern = "address-book/person/address/country")
+    private String country;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getStreet() {
+        return street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getZip() {
+        return zip;
+    }
+
+    public void setZip(String zip) {
+        this.zip = zip;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Address other = (Address) obj;
+        if (city == null) {
+            if (other.city != null)
+                return false;
+        } else if (!city.equals(other.city))
+            return false;
+        if (country == null) {
+            if (other.country != null)
+                return false;
+        } else if (!country.equals(other.country))
+            return false;
+        if (state == null) {
+            if (other.state != null)
+                return false;
+        } else if (!state.equals(other.state))
+            return false;
+        if (street == null) {
+            if (other.street != null)
+                return false;
+        } else if (!street.equals(other.street))
+            return false;
+        if (type == null) {
+            if (other.type != null)
+                return false;
+        } else if (!type.equals(other.type))
+            return false;
+        if (zip == null) {
+            if (other.zip != null)
+                return false;
+        } else if (!zip.equals(other.zip))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Address [city="
+                + city
+                + ", country="
+                + country
+                + ", state="
+                + state
+                + ", street="
+                + street
+                + ", type="
+                + type
+                + ", zip="
+                + zip
+                + "]";
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Address.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,63 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.addressbook;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetNext;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "address-book")
+public class AddressBook {
+
+    private final List<Person> people = new ArrayList<Person>();
+
+    @SetNext
+    public void addPerson(Person p) {
+        this.people.add(p);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        AddressBook other = (AddressBook) obj;
+        if (people == null) {
+            if (other.people != null)
+                return false;
+        } else if (!people.equals(other.people))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "AddressBook [people=" + people + "]";
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBook.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,81 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.addressbook;
+
+import org.apache.commons.digester3.annotations.AbstractAnnotatedPojoTestCase;
+import org.junit.Test;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+public final class AddressBookTestCase extends AbstractAnnotatedPojoTestCase {
+
+    @Test
+    public void testAddressBook() throws Exception {
+        AddressBook addressBook = new AddressBook();
+
+        Person person = new Person();
+        person.setId(1);
+        person.setCategory("acquaintance");
+        person.setName("Gonzo");
+        person.addEmail("business", "gonzo@muppets.com");
+
+        Address address = new Address();
+        address.setType("home");
+        address.setStreet("123 Maine Ave.");
+        address.setCity("Las Vegas");
+        address.setState("NV");
+        address.setZip("01234");
+        address.setCountry("USA");
+        person.addAddress(address);
+
+        address = new Address();
+        address.setType("business");
+        address.setStreet("234 Maple Dr.");
+        address.setCity("Los Angeles");
+        address.setState("CA");
+        address.setZip("98765");
+        address.setCountry("USA");
+        person.addAddress(address);
+
+        addressBook.addPerson(person);
+
+        person = new Person();
+        person.setId(2);
+        person.setCategory("rolemodel");
+        person.setName("Kermit");
+        person.addEmail("business", "kermit@muppets.com");
+        person.addEmail("home", "kermie@acme.com");
+
+        address = new Address();
+        address.setType("business");
+        address.setStreet("987 Brown Rd");
+        address.setCity("Las Cruces");
+        address.setState("NM");
+        address.setZip("75321");
+        address.setCountry("USA");
+        person.addAddress(address);
+
+        addressBook.addPerson(person);
+
+        this.verifyExpectedEqualsToParsed(addressBook);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/AddressBookTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,145 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.addressbook;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
+import org.apache.commons.digester3.annotations.rules.CallMethod;
+import org.apache.commons.digester3.annotations.rules.CallParam;
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetNext;
+import org.apache.commons.digester3.annotations.rules.SetProperty;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "address-book/person")
+public class Person {
+
+    private final Map<String, String> emails = new HashMap<String, String>();
+
+    private final List<Address> addresses = new ArrayList<Address>();
+
+    @SetProperty(pattern = "address-book/person")
+    private int id;
+
+    @SetProperty(pattern = "address-book/person")
+    private String category;
+
+    @BeanPropertySetter(pattern = "address-book/person/name")
+    private String name;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Map<String, String> getEmails() {
+        return emails;
+    }
+
+    public List<Address> getAddresses() {
+        return addresses;
+    }
+
+    @CallMethod(pattern = "address-book/person/email")
+    public void addEmail(@CallParam(pattern = "address-book/person/email", attributeName = "type") String type,
+            @CallParam(pattern = "address-book/person/email") String address) {
+        this.emails.put(type, address);
+    }
+
+    @SetNext
+    public void addAddress(Address addr) {
+        this.addresses.add(addr);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Person other = (Person) obj;
+        if (addresses == null) {
+            if (other.addresses != null)
+                return false;
+        } else if (!addresses.equals(other.addresses))
+            return false;
+        if (category == null) {
+            if (other.category != null)
+                return false;
+        } else if (!category.equals(other.category))
+            return false;
+        if (emails == null) {
+            if (other.emails != null)
+                return false;
+        } else if (!emails.equals(other.emails))
+            return false;
+        if (id != other.id)
+            return false;
+        if (name == null) {
+            if (other.name != null)
+                return false;
+        } else if (!name.equals(other.name))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Person [addresses="
+                + addresses
+                + ", category="
+                + category
+                + ", emails="
+                + emails
+                + ", id="
+                + id
+                + ", name="
+                + name
+                + "]";
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/addressbook/Person.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,122 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.catalog;
+
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetProperty;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+@ObjectCreate.List(
+        @ObjectCreate(pattern = "catalog/dvd")
+)
+public final class AudioVisual implements Item {
+
+    @SetProperty(
+            pattern = "catalog/dvd",
+            attributeName = "year-made"
+    )
+    private int yearMade;
+
+    private String category;
+
+    private String name;
+
+    private String desc;
+
+    private int runtime;
+
+    public int getYearMade() {
+        return yearMade;
+    }
+
+    public void setYearMade(int yearMade) {
+        this.yearMade = yearMade;
+    }
+
+    public String getCategory() {
+        return this.category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDesc() {
+        return this.desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    public int getRuntime() {
+        return this.runtime;
+    }
+
+    public void setRuntime(int runtime) {
+        this.runtime = runtime;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        AudioVisual other = (AudioVisual) obj;
+        if (this.category == null) {
+            if (other.getCategory() != null)
+                return false;
+        } else if (!this.category.equals(other.getCategory()))
+            return false;
+        if (this.desc == null) {
+            if (other.getDesc() != null)
+                return false;
+        } else if (!this.desc.equals(other.getDesc()))
+            return false;
+        if (this.name == null) {
+            if (other.getName() != null)
+                return false;
+        } else if (!this.name.equals(other.getName()))
+            return false;
+        if (this.runtime != other.getRuntime())
+            return false;
+        if (this.yearMade != other.getYearMade())
+            return false;
+        return true;
+    }
+
+    public void print() {
+        System.out.println(this.toString());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/AudioVisual.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,126 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.catalog;
+
+import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
+import org.apache.commons.digester3.annotations.rules.FactoryCreate;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+@FactoryCreate(
+    pattern = "catalog/book",
+    factoryClass = BookFactory.class
+)
+public final class Book implements Item {
+
+    private final String isbn;
+
+    @BeanPropertySetter(pattern = "catalog/book/title")
+    private String title;
+
+    @BeanPropertySetter(pattern = "catalog/book/author")
+    private String author;
+
+    @BeanPropertySetter(pattern = "catalog/book/desc")
+    private String desc;
+
+    public Book(String isbn) {
+        this.isbn = isbn;
+    }
+
+    public String getTitle() {
+        return this.title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getAuthor() {
+        return this.author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public String getDesc() {
+        return this.desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    public String getIsbn() {
+        return this.isbn;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Book other = (Book) obj;
+        if (this.author == null) {
+            if (other.getAuthor() != null)
+                return false;
+        } else if (!this.author.equals(other.getAuthor()))
+            return false;
+        if (this.desc == null) {
+            if (other.getDesc() != null)
+                return false;
+        } else if (!this.desc.equals(other.getDesc()))
+            return false;
+        if (this.isbn == null) {
+            if (other.getIsbn() != null)
+                return false;
+        } else if (!this.isbn.equals(other.getIsbn()))
+            return false;
+        if (this.title == null) {
+            if (other.getTitle() != null)
+                return false;
+        } else if (!this.title.equals(other.getTitle()))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Book [author="
+                + author
+                + ", desc="
+                + desc
+                + ", isbn="
+                + isbn
+                + ", title="
+                + title
+                + "]";
+    }
+
+    public void print() {
+        System.out.println(this.toString());
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Book.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.catalog;
+
+import org.apache.commons.digester3.rule.AbstractObjectCreationFactory;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+public final class BookFactory extends AbstractObjectCreationFactory<Book> {
+
+    private final static String ISBN = "isbn";
+
+    @Override
+    public Book createObject(Attributes attributes) throws Exception {
+        String isbn = attributes.getValue(ISBN);
+
+        if (isbn == null) {
+            throw new Exception(
+                    "Mandatory isbn attribute not present on book tag.");
+        }
+
+        return new Book(isbn);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/BookFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,77 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.catalog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetNext;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+@ObjectCreate.List(
+        @ObjectCreate(pattern = "catalog")
+)
+public final class Catalog {
+
+    private final List<Item> items = new ArrayList<Item>();
+
+    @SetNext({ AudioVisual.class, Book.class })
+    public void addItem(Item item) {
+        this.items.add(item);
+    }
+
+    public List<Item> getItems() {
+        return this.items;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Catalog other = (Catalog) obj;
+        if (this.items == null) {
+            if (other.getItems() != null)
+                return false;
+        } else if (!this.items.equals(other.getItems()))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Catalog [items=" + items + "]";
+    }
+
+    public void print() {
+        System.out.println("This catalog has " + this.items.size() + " items");
+
+        for (Item item : this.items) {
+            item.print();
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Catalog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,84 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.catalog;
+
+import java.util.Collection;
+import java.util.Stack;
+
+import org.apache.commons.digester3.AbstractRulesModule;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.annotations.AbstractAnnotatedPojoTestCase;
+import org.junit.Test;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+public final class CatalogTestCase extends AbstractAnnotatedPojoTestCase {
+
+    @Test
+    public void testCatalog() throws Exception {
+        Catalog catalog = new Catalog();
+
+        Book book = new Book("0-596-00184-3");
+        book.setTitle("Ant, The Definitive Guide");
+        book.setAuthor("Jesse Tilly & Eric M. Burke");
+        book.setDesc("Complete build management for Java.");
+        catalog.addItem(book);
+
+        book = new Book("0201310058");
+        book.setTitle("Effective Java");
+        book.setAuthor("Joshua Bloch");
+        book.setDesc("Tips for experienced Java software developers.");
+        catalog.addItem(book);
+
+        AudioVisual dvd = new AudioVisual();
+        dvd.setName("Drunken Master");
+        dvd.setCategory("martial arts");
+        dvd.setDesc("Hilarious slapstick starring Jackie Chan.");
+        dvd.setRuntime(106);
+        dvd.setYearMade(1978);
+        catalog.addItem(dvd);
+
+        dvd = new AudioVisual();
+        dvd.setName("The Piano");
+        dvd.setCategory("drama");
+        dvd.setDesc("Character drama set in New Zealand during the Victorian era.");
+        dvd.setRuntime(121);
+        dvd.setYearMade(1993);
+        catalog.addItem(dvd);
+
+        this.verifyExpectedEqualsToParsed(catalog);
+    }
+
+    @Override
+    protected Collection<RulesModule> getAuxModules() {
+        Collection<RulesModule> modules = new Stack<RulesModule>();
+        modules.add(new AbstractRulesModule() {
+
+            @Override
+            public void configure() {
+                forPattern("catalog/dvd/attr").setProperty("id").extractingValueFromAttribute("value");
+            }
+
+        });
+        return modules;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/CatalogTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,29 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.catalog;
+
+/**
+ * 
+ *
+ * @since 2.1
+ */
+public interface Item {
+
+    void print();
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/catalog/Item.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,147 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.employee;
+
+import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetProperty;
+import org.apache.commons.digester3.annotations.rules.SetTop;
+
+/**
+ * 
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "employee/address")
+public class Address {
+
+    @BeanPropertySetter(pattern = "employee/address/city")
+    private String city;
+
+    @BeanPropertySetter(pattern = "employee/address/state")
+    private String state;
+
+    @BeanPropertySetter(pattern = "employee/address/street")
+    private String street;
+
+    @SetProperty(
+            pattern = "employee/address",
+            attributeName = "place"
+    )
+    private String type;
+
+    @BeanPropertySetter(pattern = "employee/address/zip-code")
+    private String zipCode;
+
+    @SetTop(pattern = "employee/address")
+    public void setEmployee(Employee employee) {
+        employee.addAddress(this);
+    }
+
+    public String getCity() {
+        return this.city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getState() {
+        return this.state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getStreet() {
+        return this.street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getZipCode() {
+        return this.zipCode;
+    }
+
+    public void setZipCode(String zipCode) {
+        this.zipCode = zipCode;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Address other = (Address) obj;
+        if (this.city == null) {
+            if (other.getCity() != null)
+                return false;
+        } else if (!this.city.equals(other.getCity()))
+            return false;
+        if (this.state == null) {
+            if (other.getState() != null)
+                return false;
+        } else if (!this.state.equals(other.getState()))
+            return false;
+        if (this.street == null) {
+            if (other.getStreet() != null)
+                return false;
+        } else if (!this.street.equals(other.getStreet()))
+            return false;
+        if (this.type == null) {
+            if (other.getType() != null)
+                return false;
+        } else if (!this.type.equals(other.getType()))
+            return false;
+        if (this.zipCode == null) {
+            if (other.getZipCode() != null)
+                return false;
+        } else if (!this.zipCode.equals(other.getZipCode()))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Address [city="
+                + city
+                + ", state="
+                + state
+                + ", street="
+                + street
+                + ", type="
+                + type
+                + ", zipCode="
+                + zipCode
+                + "]";
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Address.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,109 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.employee;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetProperty;
+
+/**
+ * 
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "employee")
+public class Employee {
+
+    private final List<Address> addresses = new ArrayList<Address>();
+
+    @SetProperty(
+            pattern = "employee",
+            attributeName = "name"
+    )
+    private String firstName;
+
+    @SetProperty(
+            pattern = "employee",
+            attributeName = "surname"
+    )
+    private String lastName;
+
+    public void addAddress(Address address) {
+        this.addresses.add(address);
+    }
+
+    public String getFirstName() {
+        return this.firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return this.lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public List<Address> getAddresses() {
+        return this.addresses;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Employee other = (Employee) obj;
+        if (this.addresses == null) {
+            if (other.getAddresses() != null)
+                return false;
+        } else if (!this.addresses.equals(other.getAddresses()))
+            return false;
+        if (this.firstName == null) {
+            if (other.getFirstName() != null)
+                return false;
+        } else if (!this.firstName.equals(other.getFirstName()))
+            return false;
+        if (this.lastName == null) {
+            if (other.getLastName() != null)
+                return false;
+        } else if (!this.lastName.equals(other.getLastName()))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Employee [addresses="
+                + addresses
+                + ", firstName="
+                + firstName
+                + ", lastName="
+                + lastName
+                + "]";
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/Employee.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,66 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.employee;
+
+import java.util.Collection;
+import java.util.Stack;
+
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.annotations.AbstractAnnotatedPojoTestCase;
+import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule;
+import org.junit.Test;
+
+/**
+ * 
+ * @since 2.1
+ */
+public final class EmployeeTestCase extends AbstractAnnotatedPojoTestCase {
+
+    @Test
+    public void testEmployee() throws Exception {
+        Employee employee = new Employee();
+        employee.setFirstName("First Name");
+        employee.setLastName("Last Name");
+
+        Address address = new Address();
+        address.setCity("Home City");
+        address.setState("HS");
+        address.setStreet("Home Street");
+        address.setType("home");
+        address.setZipCode("HmZip");
+        address.setEmployee(employee);
+
+        address = new Address();
+        address.setCity("Office City");
+        address.setState("OS");
+        address.setStreet("Office Street");
+        address.setType("office");
+        address.setZipCode("OfZip");
+        address.setEmployee(employee);
+
+        this.verifyExpectedEqualsToParsed(employee);
+    }
+
+    @Override
+    protected Collection<RulesModule> getAuxModules() {
+        Collection<RulesModule> modules = new Stack<RulesModule>();
+        modules.add(new FromAnnotationsRuleModule(Address.class));
+        return modules;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/employee/EmployeeTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,33 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.failingtetst;
+
+public final class BeanWithFakeHandler {
+
+    @FakeRule
+    private String something;
+
+    public void setSomething(String something) {
+        this.something = something;
+    }
+
+    public String getSomething() {
+        return something;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/BeanWithFakeHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,36 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.failingtetst;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+import org.apache.commons.digester3.annotations.spi.AnnotationHandlerFactory;
+
+final class FailingDigesterLoaderHandlerFactory  implements AnnotationHandlerFactory {
+
+    /**
+     * {@inheritDoc}
+     */
+    public <H extends AnnotationHandler<? extends Annotation, ? extends AnnotatedElement>> H newInstance(
+            Class<H> type) throws Exception {
+        throw new Exception(String.format("Impossible to create '%s' instances", type.getName()));
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingDigesterLoaderHandlerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,37 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.failingtetst;
+
+import static org.apache.commons.digester3.DigesterLoader.newLoader;
+
+import org.apache.commons.digester3.DigesterLoadingException;
+import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule;
+import org.junit.Test;
+
+/**
+ * Tests to make sure loader fails
+ */
+public final class FailingTestCase {
+
+    @Test(expected = DigesterLoadingException.class)
+    public void failsBecauseFailingDigesterLoaderHandlerFactory() {
+        newLoader(new FromAnnotationsRuleModule(BeanWithFakeHandler.class,
+                new FailingDigesterLoaderHandlerFactory())).newDigester();
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FailingTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,32 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.failingtetst;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.annotations.AnnotationHandler;
+
+final class FakeHandler implements AnnotationHandler<Annotation, AnnotatedElement> {
+
+    public void handle(Annotation annotation, AnnotatedElement element, RulesBinder rulesBinder) {
+        // do nothing
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,36 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.failingtetst;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.commons.digester3.annotations.DigesterRule;
+import org.apache.commons.digester3.rule.SetPropertiesRule;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+@DigesterRule(
+        reflectsRule = SetPropertiesRule.class,
+        handledBy = FakeHandler.class
+)
+public @interface FakeRule {
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/failingtetst/FakeRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,123 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.person;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.digester3.annotations.rules.BeanPropertySetter;
+import org.apache.commons.digester3.annotations.rules.CallMethod;
+import org.apache.commons.digester3.annotations.rules.CallParam;
+import org.apache.commons.digester3.annotations.rules.ObjectCreate;
+import org.apache.commons.digester3.annotations.rules.SetProperty;
+
+/**
+ * 
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "person")
+public class Person {
+
+    private final Map<String, String> emails = new HashMap<String, String>();
+
+    @SetProperty(pattern = "person")
+    private int id;
+
+    @SetProperty(pattern = "person")
+    private String category;
+
+    @BeanPropertySetter(pattern = "person/name")
+    private String name;
+
+    @CallMethod(pattern = "person/email")
+    public void addEmail(@CallParam(pattern = "person/email", attributeName = "type") String type,
+            @CallParam(pattern = "person/email") String address) {
+        this.emails.put(type, address);
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Map<String, String> getEmails() {
+        return emails;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Person other = (Person) obj;
+        if (category == null) {
+            if (other.category != null)
+                return false;
+        } else if (!category.equals(other.category))
+            return false;
+        if (emails == null) {
+            if (other.emails != null)
+                return false;
+        } else if (!emails.equals(other.emails))
+            return false;
+        if (id != other.id)
+            return false;
+        if (name == null) {
+            if (other.name != null)
+                return false;
+        } else if (!name.equals(other.name))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Person [category="
+            + category
+            + ", emails="
+            + emails
+            + ", id="
+            + id
+            + ", name="
+            + name
+            + "]";
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/Person.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java?rev=1070178&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java (added)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java Sun Feb 13 01:49:45 2011
@@ -0,0 +1,41 @@
+/* $Id$
+ *
+ * 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.
+ */
+package org.apache.commons.digester3.annotations.person;
+
+import org.apache.commons.digester3.annotations.AbstractAnnotatedPojoTestCase;
+import org.junit.Test;
+
+/**
+ * 
+ * @since 2.1
+ */
+public final class PersonTestCase extends AbstractAnnotatedPojoTestCase {
+
+    @Test
+    public void testPerson() throws Exception {
+        Person person = new Person();
+        person.setId(1);
+        person.setName("Gonzo");
+        person.setCategory("acquaintance");
+        person.addEmail("business", "gonzo@muppets.com");
+        person.addEmail("home", "gonzo@mymuppets.com");
+
+        this.verifyExpectedEqualsToParsed(person);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/annotations/person/PersonTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message