01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: AnswerException.java 3813 2007-06-25 18:22:03Z gbevin $
07: */
08: package com.uwyn.rife.continuations.exceptions;
09:
10: import com.uwyn.rife.continuations.ContinuationContext;
11: import com.uwyn.rife.tools.exceptions.ControlFlowRuntimeException;
12: import com.uwyn.rife.tools.exceptions.LightweightError;
13:
14: /**
15: * This exception will be thrown when an answer continuation is triggered.
16: *
17: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
18: * @version $Revision: 3813 $
19: * @since 1.6
20: */
21: public class AnswerException extends LightweightError implements
22: ControlFlowRuntimeException {
23: private static final long serialVersionUID = 4501524247064256632L;
24:
25: private ContinuationContext mContext = null;
26: private Object mCallAnswer = null;
27:
28: /**
29: * [PRIVATE AND UNSUPPORTED] Instantiates a new answer exception.
30: * <p>This is used by the instrumented bytecode that provides
31: * continuations support, it's not intended for general use.
32: * @param context the active continuation context
33: * @param answer the answered value
34: * @since 1.6
35: */
36: public AnswerException(ContinuationContext context, Object answer) {
37: super ();
38:
39: mContext = context;
40: mCallAnswer = answer;
41: }
42:
43: /**
44: * Retrieves the context of this answer continuation.
45: *
46: * @return this answer continuation's context
47: * @since 1.6
48: */
49: public ContinuationContext getContext() {
50: return mContext;
51: }
52:
53: /**
54: * Retrieves the answered value.
55: *
56: * @return this answer continuation's anwered value; or
57: * <p>{@code null} if no answer was provided
58: * @since 1.6
59: */
60: public Object getAnswer() {
61: return mCallAnswer;
62: }
63: }
|