commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r898038 - in /commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean: ./ ServletBean.java
Date Mon, 11 Jan 2010 20:04:02 GMT
Author: simonetripodi
Date: Mon Jan 11 20:04:01 2010
New Revision: 898038

URL: http://svn.apache.org/viewvc?rev=898038&view=rev
Log:
first checkin of ServletBean class

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

Added: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean/ServletBean.java
URL: http://svn.apache.org/viewvc/commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean/ServletBean.java?rev=898038&view=auto
==============================================================================
--- commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean/ServletBean.java
(added)
+++ commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean/ServletBean.java
Mon Jan 11 20:04:01 2010
@@ -0,0 +1,120 @@
+/*
+ * 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.servletbean;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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;
+
+/**
+ * 
+ * @version $Id$
+ * @since 2.1
+ */
+@ObjectCreate(pattern = "web-app/servlet")
+public final class ServletBean {
+
+    private final Map<String, String> initParams = new HashMap<String, String>();
+
+    @BeanPropertySetter(pattern = "web-app/servlet/servlet-name")
+    private String servletName;
+
+    @BeanPropertySetter(pattern = "web-app/servlet/servlet-class")
+    private String servletClass;
+
+    @CallMethod(pattern = "web-app/servlet/init-param")
+    public void addInitParam(@CallParam(pattern = "web-app/servlet/init-param/param-name")
String name,
+            @CallParam(pattern = "web-app/servlet/init-param/param-value") String value)
{
+        this.initParams.put(name, value);
+    }
+
+    public String getServletName() {
+        return servletName;
+    }
+
+    public void setServletName(String servletName) {
+        this.servletName = servletName;
+    }
+
+    public String getServletClass() {
+        return servletClass;
+    }
+
+    public void setServletClass(String servletClass) {
+        this.servletClass = servletClass;
+    }
+
+    public Map<String, String> getInitParams() {
+        return initParams;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((initParams == null) ? 0 : initParams.hashCode());
+        result = prime * result
+                + ((servletClass == null) ? 0 : servletClass.hashCode());
+        result = prime * result
+                + ((servletName == null) ? 0 : servletName.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;
+        ServletBean other = (ServletBean) obj;
+        if (initParams == null) {
+            if (other.initParams != null)
+                return false;
+        } else if (!initParams.equals(other.initParams))
+            return false;
+        if (servletClass == null) {
+            if (other.servletClass != null)
+                return false;
+        } else if (!servletClass.equals(other.servletClass))
+            return false;
+        if (servletName == null) {
+            if (other.servletName != null)
+                return false;
+        } else if (!servletName.equals(other.servletName))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "ServletBean [initParams="
+                + initParams
+                + ", servletClass="
+                + servletClass
+                + ", servletName="
+                + servletName
+                + "]";
+    }
+
+}

Propchange: commons/sandbox/at-digester/trunk/src/test/org/apache/commons/digester/annotations/servletbean/ServletBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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



Mime
View raw message