View Javadoc

1   
2   
3   /*
4    * Copyright (C) 2005 by Arno Schumacher
5    *
6    * This file is part of net.sourceforge.servletspy
7    *
8    * net.sourceforge.servletspy is free software; you can redistribute
9    * it and/or modify it under the terms of the GNU General Public 
10   * License as published by the Free Software Foundation; either 
11   * version 2, or (at your option) any later version.
12   *
13   * net.sourceforge.servletspy is distributed in the hope that it will
14   * be useful, but WITHOUT ANY WARRANTY; without even the implied 
15   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
16   * See the GNU General Public License for more details.
17   *
18   * You should have received a copy of the GNU General Public License
19   * along with this program; if not, write to the Free Software
20   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA 
21   */
22  
23  package net.sourceforge.servletspy.config;
24  
25  /***
26   * @author arno schumacher
27   */
28  public class Handler {
29      protected String handlerClassName;
30  
31      protected Param[] handlerParams;
32  
33      Handler() {
34      }
35  
36      public Handler(final Param[] configParams, final String className) {
37          this.handlerClassName = className;
38          this.handlerParams = configParams;
39      }
40  
41      public final Param[] getConfigParam() {
42          return handlerParams == null ? new Param[0] : handlerParams;
43      }
44  
45      public final String getClassName() {
46          return handlerClassName;
47      }
48  
49      public final String toString() {
50          StringBuffer sb = new StringBuffer();
51          sb.append('[');
52          sb.append("className=");
53          sb.append(handlerClassName);
54          sb.append(", params[]={");
55          for (int i = 0; handlerParams != null && i < handlerParams.length; i++) {
56              sb.append('[');
57              sb.append(i);
58              sb.append("]=");
59              sb.append(handlerParams[i]);
60              if (i + 1 != handlerParams.length) {
61                  sb.append(", ");
62              }
63          }
64          sb.append('}');
65          return sb.toString();
66      }
67  }