commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r898326 - in /commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person: ./ Person.java
Date Tue, 12 Jan 2010 14:03:14 GMT
Author: simonetripodi
Date: Tue Jan 12 14:03:14 2010
New Revision: 898326

URL: http://svn.apache.org/viewvc?rev=898326&view=rev
Log:
first checkin of Person fake data class

Added:
    commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/
    commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/Person.java
  (with props)

Added: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/Person.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/Person.java?rev=898326&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/Person.java
(added)
+++ commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/Person.java
Tue Jan 12 14:03:14 2010
@@ -0,0 +1,136 @@
+/*
+ * 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.person;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.digester.annotations.AttributeCallParam;
+import org.apache.commons.digester.annotations.BeanPropertySetter;
+import org.apache.commons.digester.annotations.CallMethod;
+import org.apache.commons.digester.annotations.CallParam;
+import org.apache.commons.digester.annotations.ObjectCreate;
+import org.apache.commons.digester.annotations.SetProperty;
+
+/**
+ * 
+ * @version $Id$
+ * @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(@AttributeCallParam(pattern = "person/email", attribute = "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 int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((category == null) ? 0 : category.hashCode());
+        result = prime * result + ((emails == null) ? 0 : emails.hashCode());
+        result = prime * result + id;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @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/at-digester/trunk/src/test/org/apache/commons/digester/annotations/person/Person.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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



Mime
View raw message