01: /**
02: * $Id: BeanTag.java,v 1.2 2002/06/01 22:16:16 sorensen Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.util;
14:
15: import javax.servlet.jsp.*;
16: import javax.servlet.jsp.tagext.*;
17: import com.sun.portal.wireless.taglibs.base.*;
18:
19: /**
20: * BeanTag - reference a bean with a type
21: *
22: * @author Robert O'Brien
23: * @version 1.0
24: * @see com.sun.portal.wireless.taglibs.base.BeanTag
25: */
26:
27: public class BeanTag extends
28: com.sun.portal.wireless.taglibs.base.BeanTag {
29: /**
30: * The type or class of the bean object
31: */
32: String type;
33:
34: /**
35: * Get the class type of the bean
36: *
37: * @return the bean class
38: */
39: public String getType() {
40: return type;
41: }
42:
43: /**
44: * Set the class type of the bean
45: *
46: * @param type the bean class
47: */
48: public void setType(String type) {
49: this .type = type;
50: }
51:
52: /**
53: * Create a new bean of the specified class type
54: *
55: * @return the bean object
56: */
57: public Object newBean() throws Exception {
58:
59: if (type == null) {
60: throw new Exception("BeanTag: missing 'type' attribute");
61: }
62:
63: return Class.forName(type).newInstance();
64: }
65: }
|