Source Code Cross Referenced for JumpException.java in  » Scripting » jruby » org » jruby » exceptions » 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 » Scripting » jruby » org.jruby.exceptions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***** BEGIN LICENSE BLOCK *****
002:         * Version: CPL 1.0/GPL 2.0/LGPL 2.1
003:         *
004:         * The contents of this file are subject to the Common Public
005:         * License Version 1.0 (the "License"); you may not use this file
006:         * except in compliance with the License. You may obtain a copy of
007:         * the License at http://www.eclipse.org/legal/cpl-v10.html
008:         *
009:         * Software distributed under the License is distributed on an "AS
010:         * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
011:         * implied. See the License for the specific language governing
012:         * rights and limitations under the License.
013:         *
014:         * Copyright (C) 2002 Anders Bengtsson <ndrsbngtssn@yahoo.se>
015:         * Copyright (C) 2002 Jan Arne Petersen <jpetersen@uni-bonn.de>
016:         * Copyright (C) 2005 Charles O Nutter <headius@headius.com>
017:         * Copyright (C) 2007 Thomas E Enebo <enebo@acm.org>
018:         * Copyright (C) 2007 Miguel Covarrubias <mlcovarrubias@gmail.com>
019:         *
020:         * Alternatively, the contents of this file may be used under the terms of
021:         * either of the GNU General Public License Version 2 or later (the "GPL"),
022:         * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
023:         * in which case the provisions of the GPL or the LGPL are applicable instead
024:         * of those above. If you wish to allow use of your version of this file only
025:         * under the terms of either the GPL or the LGPL, and not to allow others to
026:         * use your version of this file under the terms of the CPL, indicate your
027:         * decision by deleting the provisions above and replace them with the notice
028:         * and other provisions required by the GPL or the LGPL. If you do not delete
029:         * the provisions above, a recipient may use your version of this file under
030:         * the terms of any one of the CPL, the GPL or the LGPL.
031:         ***** END LICENSE BLOCK *****/package org.jruby.exceptions;
032:
033:        /**
034:         * This class should be used for performance reasons if the
035:         * Exception don't need a stack trace.
036:         *
037:         * @author jpetersen
038:         */
039:        public class JumpException extends RuntimeException {
040:            private static final long serialVersionUID = -228162532535826617L;
041:
042:            public static final class JumpType {
043:                public static final int BREAK = 0;
044:                public static final int NEXT = 1;
045:                public static final int REDO = 2;
046:                public static final int RETRY = 3;
047:                public static final int RETURN = 4;
048:                public static final int THROW = 5;
049:                public static final int RAISE = 6;
050:                public static final int SPECIAL = 7;
051:
052:                public static final JumpType BreakJump = new JumpType(BREAK);
053:                public static final JumpType NextJump = new JumpType(NEXT);
054:                public static final JumpType RedoJump = new JumpType(REDO);
055:                public static final JumpType RetryJump = new JumpType(RETRY);
056:                public static final JumpType ReturnJump = new JumpType(RETURN);
057:                public static final JumpType ThrowJump = new JumpType(THROW);
058:                public static final JumpType RaiseJump = new JumpType(RAISE);
059:                public static final JumpType SpecialJump = new JumpType(SPECIAL);
060:
061:                private final int typeId;
062:
063:                private JumpType(int typeId) {
064:                    this .typeId = typeId;
065:                }
066:
067:                public int getTypeId() {
068:                    return typeId;
069:                }
070:            }
071:
072:            private JumpType jumpType;
073:            private Object target;
074:            private Object value;
075:
076:            // FIXME: Remove inKernelLoop from this and come up with something more general
077:            // Hack to detect a break in Kernel#loop
078:            private boolean inKernelLoop = false;
079:
080:            /**
081:             * Constructor for flow-control-only JumpExceptions.
082:             */
083:            public JumpException() {
084:            }
085:
086:            /**
087:             * Constructor for JumpException.
088:             */
089:            public JumpException(JumpType jumpType) {
090:                super ();
091:                this .jumpType = jumpType;
092:            }
093:
094:            /**
095:             * Constructor for JumpException.
096:             * @param msg
097:             */
098:            public JumpException(String msg, JumpType jumpType) {
099:                super (msg);
100:                this .jumpType = jumpType;
101:            }
102:
103:            public JumpException(String msg, Throwable cause, JumpType jumpType) {
104:                super (msg, cause);
105:                this .jumpType = jumpType;
106:            }
107:
108:            /** This method don't do anything for performance reasons.
109:             *
110:             * @see Throwable#fillInStackTrace()
111:             */
112:            public Throwable fillInStackTrace() {
113:                return this ;
114:            }
115:
116:            protected Throwable originalFillInStackTrace() {
117:                return super .fillInStackTrace();
118:            }
119:
120:            public JumpType getJumpType() {
121:                return jumpType;
122:            }
123:
124:            public void setJumpType(JumpType jumpType) {
125:                // this is like clearing out the exception, so we flush other fields here as well
126:                this .jumpType = jumpType;
127:                this .target = null;
128:                this .value = null;
129:                this .inKernelLoop = false;
130:            }
131:
132:            /**
133:             * @return Returns the target.
134:             */
135:            public Object getTarget() {
136:                return target;
137:            }
138:
139:            /**
140:             * @param target The target (destination) of the jump.
141:             */
142:            public void setTarget(Object target) {
143:                this .target = target;
144:            }
145:
146:            /**
147:             * Get the value that will returned when the jump reaches its destination
148:             *
149:             * @return Returns the return value.
150:             */
151:            public Object getValue() {
152:                return value;
153:            }
154:
155:            /**
156:             * Set the value that will be returned when the jump reaches its destination
157:             *
158:             * @param value the value to be returned.
159:             */
160:            public void setValue(Object value) {
161:                this .value = value;
162:            }
163:
164:            public void setBreakInKernelLoop(boolean inKernelLoop) {
165:                this .inKernelLoop = inKernelLoop;
166:            }
167:
168:            public boolean isBreakInKernelLoop() {
169:                return inKernelLoop;
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.