Source Code Cross Referenced for SimpleType.java in  » JMX » mx4j » 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 » JMX » mx4j » javax.management.openmbean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (C) The MX4J Contributors.
003:         * All rights reserved.
004:         *
005:         * This software is distributed under the terms of the MX4J License version 1.0.
006:         * See the terms of the MX4J License in the documentation provided with this software.
007:         */package javax.management.openmbean;
008:
009:        import java.io.ObjectStreamException;
010:        import java.io.Serializable;
011:
012:        /**
013:         * <p>The SimpleType class is the open type class whose instances describe all open data values which are neither arrays,
014:         * nor {@link CompositeData} values, nor {@link TabularData} values. It predefines all its possible instances as static fields,
015:         * and has no public constructor.</p>
016:         * <p/>
017:         * <p>Given a SimpleType instance describing values whose Java class name is className, the internal fields corresponding to the
018:         * TypeName and description of this SimpleType instance are also set to className. In other words, its methods getClassName, getTypeName
019:         * and getDescription all return the same string value className.</p>
020:         *
021:         * @version $Revision: 1.13 $
022:         */
023:        public final class SimpleType extends OpenType implements  Serializable {
024:            private static final long serialVersionUID = 2215577471957694503L;
025:
026:            // No non-transient fields allowed
027:
028:            public final static SimpleType BIGDECIMAL;
029:            public final static SimpleType BIGINTEGER;
030:            public final static SimpleType BOOLEAN;
031:            public final static SimpleType BYTE;
032:            public final static SimpleType CHARACTER;
033:            public final static SimpleType DOUBLE;
034:            public final static SimpleType FLOAT;
035:            public final static SimpleType INTEGER;
036:            public final static SimpleType LONG;
037:            public final static SimpleType OBJECTNAME;
038:            public final static SimpleType SHORT;
039:            public final static SimpleType STRING;
040:            public final static SimpleType DATE;
041:            public final static SimpleType VOID;
042:
043:            static {
044:                /*
045:                 * We need to assign them to temp one by one, or the compiler
046:                 * will complain. We need to assign temp=null even though
047:                 * the exception will not happen.
048:                 */
049:                SimpleType temp = null;
050:                try {
051:                    temp = new SimpleType("java.math.BigDecimal");
052:                } catch (OpenDataException ignored) {
053:                }
054:                BIGDECIMAL = temp;
055:                temp = null;
056:
057:                // BIGINTEGER
058:                try {
059:                    temp = new SimpleType("java.math.BigInteger");
060:                } catch (OpenDataException ignored) {
061:                }
062:                BIGINTEGER = temp;
063:                temp = null;
064:
065:                //BOOLEAN
066:                try {
067:                    temp = new SimpleType("java.lang.Boolean");
068:                } catch (OpenDataException ignored) {
069:                }
070:                BOOLEAN = temp;
071:                temp = null;
072:
073:                //BYTE
074:                try {
075:                    temp = new SimpleType("java.lang.Byte");
076:                } catch (OpenDataException ignored) {
077:                }
078:                BYTE = temp;
079:                temp = null;
080:
081:                //CHARACTER
082:                try {
083:                    temp = new SimpleType("java.lang.Character");
084:                } catch (OpenDataException ignored) {
085:                }
086:                CHARACTER = temp;
087:                temp = null;
088:
089:                //DOUBLE
090:                try {
091:                    temp = new SimpleType("java.lang.Double");
092:                } catch (OpenDataException ignored) {
093:                }
094:                DOUBLE = temp;
095:                temp = null;
096:
097:                //FLOAT
098:                try {
099:                    temp = new SimpleType("java.lang.Float");
100:                } catch (OpenDataException ignored) {
101:                }
102:                FLOAT = temp;
103:                temp = null;
104:
105:                //INTEGER
106:                try {
107:                    temp = new SimpleType("java.lang.Integer");
108:                } catch (OpenDataException ignored) {
109:                }
110:                INTEGER = temp;
111:                temp = null;
112:
113:                //LONG
114:                try {
115:                    temp = new SimpleType("java.lang.Long");
116:                } catch (OpenDataException ignored) {
117:                }
118:                LONG = temp;
119:                temp = null;
120:
121:                //OBJECTNAME
122:                try {
123:                    temp = new SimpleType("javax.management.ObjectName");
124:                } catch (OpenDataException ignored) {
125:                }
126:                OBJECTNAME = temp;
127:                temp = null;
128:
129:                //SHORT
130:                try {
131:                    temp = new SimpleType("java.lang.Short");
132:                } catch (OpenDataException ignored) {
133:                }
134:                SHORT = temp;
135:                temp = null;
136:
137:                //STRING
138:                try {
139:                    temp = new SimpleType("java.lang.String");
140:                } catch (OpenDataException ignored) {
141:                }
142:                STRING = temp;
143:                temp = null;
144:
145:                //DATE
146:                try {
147:                    temp = new SimpleType("java.util.Date");
148:                } catch (OpenDataException ignored) {
149:                }
150:                DATE = temp;
151:                temp = null;
152:
153:                //VOID
154:                try {
155:                    temp = new SimpleType("java.lang.Void");
156:                } catch (OpenDataException ignored) {
157:                }
158:                VOID = temp;
159:                temp = null;
160:            }
161:
162:            private transient int m_hashCode = 0;
163:
164:            private SimpleType(String className) throws OpenDataException {
165:                super (className, className, className);
166:            }
167:
168:            /**
169:             * Checks if this <code>SimpleType</code> object is value of
170:             * the given object
171:             *
172:             * @param object The object to check
173:             * @return boolean
174:             */
175:            public boolean isValue(Object object) {
176:                if (object == null)
177:                    return false;
178:                return getClassName().equals(object.getClass().getName());
179:            }
180:
181:            public Object readResolve() throws ObjectStreamException {
182:                //TODO: need a better way of doing this
183:                if (getClassName().equals(String.class.getName()))
184:                    return SimpleType.STRING;
185:                if (getClassName().equals(java.math.BigDecimal.class.getName()))
186:                    return SimpleType.BIGDECIMAL;
187:                if (getClassName().equals(java.math.BigInteger.class.getName()))
188:                    return SimpleType.BIGINTEGER;
189:                if (getClassName().equals(Boolean.class.getName()))
190:                    return SimpleType.BOOLEAN;
191:                if (getClassName().equals(Byte.class.getName()))
192:                    return SimpleType.BYTE;
193:                if (getClassName().equals(Character.class.getName()))
194:                    return SimpleType.CHARACTER;
195:                if (getClassName().equals(Double.class.getName()))
196:                    return SimpleType.DOUBLE;
197:                if (getClassName().equals(Float.class.getName()))
198:                    return SimpleType.FLOAT;
199:                if (getClassName().equals(Integer.class.getName()))
200:                    return SimpleType.INTEGER;
201:                if (getClassName().equals(Long.class.getName()))
202:                    return SimpleType.LONG;
203:                if (getClassName().equals(
204:                        javax.management.ObjectName.class.getName()))
205:                    return SimpleType.OBJECTNAME;
206:                if (getClassName().equals(Short.class.getName()))
207:                    return SimpleType.SHORT;
208:                if (getClassName().equals(Void.class.getName()))
209:                    return SimpleType.VOID;
210:                if (getClassName().equals(java.util.Date.class.getName()))
211:                    return SimpleType.DATE;
212:
213:                return null;
214:            }
215:
216:            /**
217:             * Check the given object for equality
218:             *
219:             * @return boolean if object is equal
220:             */
221:            public boolean equals(Object object) {
222:                if (!(object instanceof  SimpleType))
223:                    return false;
224:                SimpleType otherType = (SimpleType) object;
225:                return (this .getClassName().equals(otherType.getClassName()));
226:            }
227:
228:            /**
229:             * Retrieve the hashCode
230:             *
231:             * @return int The computed hasCode
232:             */
233:            public int hashCode() {
234:                if (m_hashCode == 0) {
235:                    int result = getClassName().hashCode();
236:                    m_hashCode = result;
237:                }
238:                return m_hashCode;
239:            }
240:
241:            /**
242:             * Returns a human readable representation of this SimpleType object
243:             *
244:             * @return String the String representation
245:             */
246:            public String toString() {
247:                return (getClass().getName() + "(name = " + getTypeName() + ")");
248:            }
249:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.