Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 12619 invoked from network); 11 Jan 2010 20:04:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jan 2010 20:04:23 -0000 Received: (qmail 16537 invoked by uid 500); 11 Jan 2010 20:04:23 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 16453 invoked by uid 500); 11 Jan 2010 20:04:23 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 16444 invoked by uid 99); 11 Jan 2010 20:04:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jan 2010 20:04:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jan 2010 20:04:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 565772388906; Mon, 11 Jan 2010 20:04:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: simonetripodi@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100111200402.565772388906@eris.apache.org> 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 initParams = new HashMap(); + + @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 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