Source code: org/milligan/eccles/EcclesReturnValue.java
1 package org.milligan.eccles;
2
3 /**
4 * Definition of a return value from a tag with optional additional information.
5 * @author Ian Tomey
6 *
7 */
8
9 public class EcclesReturnValue {
10
11 public static final int CODE_SKIP_CHILDREN = 0;
12 /**
13 * Continue and process children. Valid return from doStartTag and doAfterChildren
14 */
15 public static final int CODE_PROCESS_CHILDREN = 1;
16 /**
17 * Contine processing with the next sibling. Valid return from doEndTag
18 */
19 public static final int CODE_CONTINUE_PROCESSING = 3;
20 /**
21 * Break processing and return to a parent tag. Valid return from doEndTag
22 */
23 public static final int CODE_BREAK = 4;
24 /**
25 * An exception has been thrown, go up the stack to an exception handler
26 */
27 public static final int CODE_EXCEPTION = 5;
28
29 public EcclesReturnValue(int rv) {
30 this.returnValue=rv;
31 }
32
33 public EcclesReturnValue(int rv,String string) {
34 this.returnValue = rv;
35 this.string = string;
36 }
37
38 public EcclesReturnValue(int rv, EcclesException exception) {
39 this.returnValue = rv;
40 this.exception = exception;
41 }
42
43 /**
44 * The return value code
45 */
46 private int returnValue;
47
48 /**
49 * The string property. Valid for use when the return value code is<br>
50 * CODE_BREAK. Value = id of tag to break to or null for nearest
51 */
52 private String string;
53
54 /**
55 * The string property. Valid for use when the return value code is<br>
56 * CODE_EXCEPTION
57 */
58 private org.milligan.eccles.EcclesException exception;
59
60 public int getReturnValue() {
61 return returnValue;
62 }
63 public void setReturnValue(int returnValue) {
64 this.returnValue = returnValue;
65 }
66 public void setString(String string) {
67 this.string = string;
68 }
69 public String getString() {
70 return string;
71 }
72 public void setException(org.milligan.eccles.EcclesException exception) {
73 this.exception = exception;
74 }
75 public org.milligan.eccles.EcclesException getException() {
76 return exception;
77 }
78 public boolean isBreakOrException() {
79 if (returnValue == CODE_BREAK || returnValue == CODE_EXCEPTION )
80 return true;
81 return false;
82 }
83 public boolean isException() {
84 return returnValue==CODE_EXCEPTION;
85 }
86 }