KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > config > DynamicItem


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.config;
31
32 import com.caucho.log.Log;
33 import com.caucho.util.L10N;
34
35 import java.util.logging.Logger JavaDoc;
36
37 /**
38  * A dynamic item represents a tag value which is determined at runtime.
39  */

40 public class DynamicItem {
41   static final Logger JavaDoc log = Log.open(DynamicItem.class);
42   static final L10N L = new L10N(DynamicItem.class);
43
44   private String JavaDoc _tag;
45   private Class JavaDoc _beanClass;
46   private String JavaDoc _methodName;
47
48   /**
49    * Zero-arg constructor.
50    */

51   public DynamicItem()
52   {
53   }
54
55   /**
56    * Creates a new dynamic item.
57    *
58    * @param tag the configuration tag name.
59    * @param cl the bean class to be instantiated
60    * @param methodName the container bean's method name.
61    */

62   public DynamicItem(String JavaDoc tag, Class JavaDoc beanClass, String JavaDoc methodName)
63   {
64     _tag = tag;
65     _beanClass = beanClass;
66     _methodName = methodName;
67   }
68
69   /**
70    * Returns the tag name for the dynamic item.
71    *
72    * (XXX: namespace? s/b QName?)
73    */

74   public String JavaDoc getTag()
75   {
76     return _tag;
77   }
78
79   /**
80    * Sets the tag name for the dynamic item.
81    */

82   public void setTag(String JavaDoc tag)
83   {
84     _tag = tag;
85   }
86
87   /**
88    * Returns the tag's bean class.
89    */

90   public Class JavaDoc getBeanClass()
91   {
92     return _beanClass;
93   }
94
95   /**
96    * Sets the tag's bean class.
97    */

98   public void setBeanClass(Class JavaDoc beanClass)
99   {
100     _beanClass = beanClass;
101   }
102
103   /**
104    * Returns the container's set method name.
105    */

106   public String JavaDoc getMethodName()
107   {
108     return _methodName;
109   }
110
111   /**
112    * Sets the container's set method name.
113    */

114   public void setMethodName(String JavaDoc methodName)
115   {
116     _methodName = methodName;
117   }
118
119   public String JavaDoc toString()
120   {
121     return ("DynamicItem[tag=" + _tag + ",class=" + _beanClass.getName() +
122             ",method=" + _methodName + "]");
123   }
124 }
125
126
Popular Tags