Source Code Cross Referenced for BeansTag.java in  » Portal » Open-Portal » com » sun » portal » wireless » taglibs » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.wireless.taglibs.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: BeansTag.java,v 1.3 2004/04/26 23:11:18 saare Exp $
003:         * Copyright 2002 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.wireless.taglibs.util;
014:
015:        import java.util.*;
016:        import javax.servlet.jsp.*;
017:        import javax.servlet.jsp.tagext.*;
018:        import com.sun.portal.wireless.taglibs.base.*;
019:
020:        /**
021:         * BeansTag - make a collection of beans available
022:         *
023:         * Attributes:
024:         *
025:         * id
026:         *   name of the collection to save on page context
027:         * name
028:         *   name of the collection to retrieve from page context
029:         * size
030:         *   number of beans to create for the collection
031:         * type
032:         *   class type of the bean to create
033:         * 
034:         * @author Robert O'Brien
035:         * @version 1.0
036:         * @see com.sun.portal.wireless.taglibs.base.CollectionTag
037:         * @see com.sun.portal.wireless.taglibs.util.BeanTag
038:         */
039:
040:        public class BeansTag extends CollectionTag {
041:
042:            /**
043:             * The type or class of the bean object
044:             */
045:            String type;
046:
047:            /**
048:             * Get the class type of the bean
049:             * 
050:             * @return the bean class
051:             */
052:            public String getType() {
053:                return type;
054:            }
055:
056:            /**
057:             * Set the class type of the bean
058:             * 
059:             * @param type   the bean class
060:             */
061:            public void setType(String type) {
062:                this .type = type;
063:            }
064:
065:            /**
066:             * The size of the bean collection
067:             */
068:            int size;
069:
070:            /**
071:             * Get the size of the bean collection
072:             * 
073:             * @return size of the bean collection
074:             */
075:            public String getSize() {
076:                return Integer.toString(size);
077:            }
078:
079:            /**
080:             * Set the size of the bean collection
081:             * 
082:             * @param type   the bean class
083:             */
084:            public void setSize(String size) {
085:                try {
086:                    this .size = Integer.parseInt(size);
087:                } catch (NumberFormatException e) {
088:                    this .size = 0;
089:                }
090:            }
091:
092:            /**
093:             * Create a list of beans of the specified class type
094:             * 
095:             * @return the bean object
096:             */
097:            public Collection findCollection() throws Exception {
098:
099:                if (type == null) {
100:                    throw new Exception("BeansTag: missing 'type' attribute");
101:                }
102:
103:                if (size < 0) {
104:                    throw new Exception("BeansTag: invalid 'size' attribute");
105:                }
106:
107:                ArrayList list = new ArrayList(size);
108:                Class beanClass = Class.forName(type);
109:
110:                for (int i = 0; i < size; i++) {
111:                    list.add(beanClass.newInstance());
112:                }
113:
114:                return list;
115:            }
116:
117:            /**
118:             * Cleanup
119:             */
120:            public void release() {
121:                super .release();
122:                type = null;
123:                size = 0;
124:            }
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.