You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2010/01/21 16:29:29 UTC
svn commit: r901739 - in
/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee:
./ Address.java Employee.java Employee.xml
Author: simonetripodi
Date: Thu Jan 21 15:29:28 2010
New Revision: 901739
URL: http://svn.apache.org/viewvc?rev=901739&view=rev
Log:
first checkin of employee test case entities
Added:
commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/
commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java (with props)
commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java (with props)
commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml (with props)
Added: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java?rev=901739&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java (added)
+++ commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java Thu Jan 21 15:29:28 2010
@@ -0,0 +1,147 @@
+/*
+ * 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.digester.annotations.employee;
+
+import org.apache.commons.digester.annotations.BeanPropertySetter;
+import org.apache.commons.digester.annotations.ObjectCreate;
+import org.apache.commons.digester.annotations.SetProperty;
+import org.apache.commons.digester.annotations.SetTop;
+
+/**
+ *
+ * @version $Id$
+ * @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/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Address.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java?rev=901739&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java (added)
+++ commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java Thu Jan 21 15:29:28 2010
@@ -0,0 +1,82 @@
+/*
+ * 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.digester.annotations.employee;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.digester.annotations.ObjectCreate;
+import org.apache.commons.digester.annotations.SetProperty;
+
+/**
+ *
+ * @version $Id$
+ * @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 String toString() {
+ return "Employee [addresses="
+ + addresses
+ + ", firstName="
+ + firstName
+ + ", lastName="
+ + lastName
+ + "]";
+ }
+
+}
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml?rev=901739&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml (added)
+++ commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml Thu Jan 21 15:29:28 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+ version: $Id$
+-->
+<employee name="First Name" surname="Last Name">
+
+ <address place="home">
+ <street>Home Street</street>
+ <city>Home City</city>
+ <state>HS</state>
+ <zip-code>HmZip</zip-code>
+ </address>
+
+ <address place="office">
+ <street>Office Street</street>
+ <city>Office City</city>
+ <state>OS</state>
+ <zip-code>OfZip</zip-code>
+ </address>
+
+</employee>
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/employee/Employee.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml