Source Code Cross Referenced for TabularType.java in  » EJB-Server-JBoss-4.2.1 » jmx » javax » management » openmbean » 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 » EJB Server JBoss 4.2.1 » jmx » javax.management.openmbean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JBoss, Home of Professional Open Source.
003:         * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004:         * as indicated by the @author tags. See the copyright.txt file in the
005:         * distribution for a full listing of individual contributors.
006:         *
007:         * This is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU Lesser General Public License as
009:         * published by the Free Software Foundation; either version 2.1 of
010:         * the License, or (at your option) any later version.
011:         *
012:         * This software is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this software; if not, write to the Free
019:         * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021:         */
022:        package javax.management.openmbean;
023:
024:        import java.util.ArrayList;
025:        import java.util.Collections;
026:        import java.util.Iterator;
027:        import java.util.List;
028:        import java.io.Serializable;
029:
030:        /**
031:         * The TabularType is an OpenType that describes TabularData.
032:         *
033:         * @see TabularData
034:         *
035:         * @author  <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
036:         *
037:         * @version $Revision: 57200 $
038:         *
039:         */
040:        public class TabularType extends OpenType implements  Serializable {
041:            // Attributes ----------------------------------------------------
042:
043:            /**
044:             * The open type of the rows
045:             */
046:            private CompositeType rowType;
047:
048:            /**
049:             * Index names
050:             */
051:            private List indexNames;
052:
053:            /**
054:             * Cached hash code
055:             */
056:            private transient int cachedHashCode = 0;
057:
058:            /**
059:             * Cached string representation
060:             */
061:            private transient String cachedToString = null;
062:
063:            // Static --------------------------------------------------------
064:
065:            private static final long serialVersionUID = 6554071860220659261L;
066:
067:            // Constructors --------------------------------------------------
068:
069:            /**
070:             * Construct a tabular type. The parameters are checked for validity.<p>
071:             *
072:             * getClassName() returns javax.management.openbean.TabularData<p>
073:             *
074:             * @param typeName the name of the tabular type, cannot be null or
075:             *        empty
076:             * @param description the human readable description of the tabular type, 
077:             *        cannot be null or empty
078:             * @param rowType the type of the row elements in the tabular data, cannot
079:             *        be null
080:             * @param indexNames the names of the item values that uniquely index each
081:             *        row element in the tabular data, cannot be null or empty. Each
082:             *        element must be an item name in the rowType, nul or empty is not
083:             *        allowed. The order of the item names in this parameter is used
084:             *        by {@link TabularData#get} and {@link TabularData#remove} the 
085:             *        TabularData to match the array of values to items.
086:             * @exception OpenDataException when an element of indexNames is not defined
087:             *            in rowType.
088:             * @exception IllegalArgumentException when a parameter does not match
089:             *            what is described above.
090:             */
091:            public TabularType(String typeName, String description,
092:                    CompositeType rowType, String[] indexNames)
093:                    throws OpenDataException {
094:                super (TabularData.class.getName(), typeName, description);
095:                if (rowType == null)
096:                    throw new IllegalArgumentException("null rowType");
097:                if (indexNames == null || indexNames.length == 0)
098:                    throw new IllegalArgumentException(
099:                            "null or empty indexNames");
100:                this .rowType = rowType;
101:                this .indexNames = new ArrayList();
102:                for (int i = 0; i < indexNames.length; i++) {
103:                    if (indexNames[i] == null)
104:                        throw new IllegalArgumentException("null index name "
105:                                + i);
106:                    String indexName = indexNames[i].trim();
107:                    if (indexName.length() == 0)
108:                        throw new IllegalArgumentException("empty index name "
109:                                + i);
110:                    if (rowType.containsKey(indexName) == false)
111:                        throw new OpenDataException("no item name " + indexName);
112:                    this .indexNames.add(indexName);
113:                }
114:            }
115:
116:            // Public --------------------------------------------------------
117:
118:            /**
119:             * Retrieve the row type
120:             *
121:             * @return the row type
122:             */
123:            public CompositeType getRowType() {
124:                return rowType;
125:            }
126:
127:            /**
128:             * Retrieve an unmodifiable list of index names in the same order as
129:             * passed to the constructor.
130:             *
131:             * @return the index names
132:             */
133:            public List getIndexNames() {
134:                return Collections.unmodifiableList(indexNames);
135:            }
136:
137:            // OpenType Overrides --------------------------------------------
138:
139:            /**
140:             * Determines whether the object is a value of the this tabular type.<p>
141:             *
142:             * The object must not be null and it must be an instance of
143:             * javax.management.openbean.TabularData. The TabularType of the
144:             * TabularData have equality with this TabularType.
145:             *
146:             * @param obj the object to test
147:             * @return the true when the above condition is satisfied, false otherwise
148:             */
149:            public boolean isValue(Object obj) {
150:                if (obj == null || !(obj instanceof  TabularData))
151:                    return false;
152:                TabularType other = ((TabularData) obj).getTabularType();
153:                return equals(other);
154:            }
155:
156:            /**
157:             * Tests for equality with another composite type<p>
158:             *
159:             * The type names must be equal.<br>
160:             * The row types are equal<br>
161:             * The index names are the same and in the same order.
162:             *
163:             * @param obj the other tabular type to test
164:             * @return the true when the above condition is satisfied, false otherwise
165:             */
166:            public boolean equals(Object obj) {
167:                if (obj == null || (obj instanceof  TabularType) == false)
168:                    return false;
169:                if (this  == obj)
170:                    return true;
171:
172:                TabularType other = (TabularType) obj;
173:                if (this .getTypeName().equals(other.getTypeName()) == false)
174:                    return false;
175:                if (this .getRowType().equals(other.getRowType()) == false)
176:                    return false;
177:                Iterator this Names = this .getIndexNames().iterator();
178:                Iterator otherNames = other.getIndexNames().iterator();
179:                while (this Names.hasNext() && otherNames.hasNext()) {
180:                    String this Name = (String) this Names.next();
181:                    String otherName = (String) otherNames.next();
182:                    if (this Name.equals(otherName) == false)
183:                        return false;
184:                }
185:                if (this Names.hasNext() || otherNames.hasNext())
186:                    return false;
187:
188:                return true;
189:            }
190:
191:            public int hashCode() {
192:                if (cachedHashCode != 0)
193:                    return cachedHashCode;
194:                cachedHashCode = getTypeName().hashCode();
195:                cachedHashCode += getRowType().hashCode();
196:                for (Iterator i = indexNames.iterator(); i.hasNext();)
197:                    cachedHashCode += i.next().hashCode();
198:                return cachedHashCode;
199:            }
200:
201:            public String toString() {
202:                if (cachedToString != null)
203:                    return cachedToString;
204:                StringBuffer buffer = new StringBuffer(getClass().getName());
205:                buffer.append(": typeName=[");
206:                buffer.append(getTypeName());
207:                buffer.append("] rowType=[");
208:                buffer.append(getRowType());
209:                buffer.append("] indexNames=[");
210:                Iterator this Names = getIndexNames().iterator();
211:                while (this Names.hasNext()) {
212:                    buffer.append(this Names.next());
213:                    if (this Names.hasNext())
214:                        buffer.append(", ");
215:                }
216:                buffer.append("]");
217:                cachedToString = buffer.toString();
218:                return cachedToString;
219:            }
220:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.