Source Code Cross Referenced for SJSharp.java in  » Database-ORM » SimpleORM » simpleorm » core » 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 » Database ORM » SimpleORM » simpleorm.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package simpleorm.core;
002:
003:        /**
004:         * This class contains a few required utilities to enable SimpleORM to run
005:         * under j# (.net)! 
006:         * The only other classes that need overriding are 
007:         * SArraylist, SThreadLocal, and SSerializable.
008:         * If you are not interested in J#/.Net this will not affect you.
009:         */
010:
011:        public class SJSharp {
012:            /**
013:               Java Class is .net System.Type
014:             */
015:            static public Class castToClass(Object clas) {
016:                return (Class) clas;
017:            }
018:
019:            static public String jvmVersion() {
020:                return Package.getPackage("java.lang")
021:                        .getImplementationVersion();
022:            }
023:
024:            static public int object2Int(Object obj) {
025:                if (obj == null)
026:                    return 0;
027:                if (obj instanceof  Number)
028:                    return ((Number) obj).intValue();
029:                else
030:                    return Integer.parseInt(obj.toString());
031:            }
032:
033:            static public long object2Long(Object obj) {
034:                if (obj == null)
035:                    return 0;
036:                if (obj instanceof  Number)
037:                    return ((Number) obj).longValue();
038:                else
039:                    return Long.parseLong(obj.toString());
040:            }
041:
042:            static public double object2Double(Object obj) {
043:                if (obj == null)
044:                    return 0;
045:                if (obj instanceof  Number)
046:                    return ((Number) obj).doubleValue();
047:                else
048:                    return Double.parseDouble(obj.toString());
049:            }
050:
051:            static public boolean object2Boolean(Object obj) {
052:                if (obj == null)
053:                    return false;
054:                if (obj instanceof  Boolean)
055:                    return ((Boolean) obj).booleanValue();
056:                else
057:                    return Boolean.valueOf(obj.toString()).booleanValue();
058:            }
059:
060:            /**
061:             * These classes allow the java.lang.int etc. classes to be replaced
062:             * by native .Net classes.
063:             */
064:
065:            static public Object newInteger(int i) {
066:                return new Integer(i);
067:            }
068:
069:            static public Object newInteger(String s) {
070:                return new Integer(Integer.parseInt(s));
071:            }
072:
073:            static public Object newInteger(Number n) {
074:                return newInteger(n.intValue());
075:            }
076:
077:            static public Object newLong(long i) {
078:                return new Long(i);
079:            }
080:
081:            static public Object newLong(Number n) {
082:                return newLong(n.intValue());
083:            }
084:
085:            static public Object newLong(String s) {
086:                return newLong(Long.parseLong(s));
087:            }
088:
089:            static public Object newDouble(double i) {
090:                return new Double(i);
091:            }
092:
093:            static public Object newDouble(Number n) {
094:                return newDouble(n.intValue());
095:            }
096:
097:            static public Object newDouble(String s) {
098:                return newDouble(Double.parseDouble(s));
099:            }
100:
101:            static public boolean isInteger(Object obj) {
102:                return obj instanceof  Integer;
103:            }
104:
105:            static public boolean isLong(Object obj) {
106:                return obj instanceof  Long;
107:            }
108:
109:            static public boolean isDouble(Object obj) {
110:                return obj instanceof  Double;
111:            }
112:
113:        }
114:
115:        /*
116:         public class  SJSharp {
117:         static public Class castToClass(object clas) {
118:         if (clas instanceof Class)
119:         return (Class)clas;
120:         else
121:         return Class.FromType((System.Type)clas);
122:         }
123:         static public String jvmVersion() {
124:         return System.Environment.get_Version().ToString();
125:         }
126:
127:         static public int object2Int(object obj) {
128:         if (obj == null) return 0;
129:         return Integer.parseInt(obj.toString());
130:         }
131:         static public long object2Long(object obj) {
132:         if (obj == null) return 0;
133:         return Long.parseLong(obj.toString());
134:         }
135:         static public double object2Double(object obj) {
136:         if (obj == null) return 0;
137:         return Double.parseDouble(obj.toString());
138:         }
139:         }
140:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.