Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
VoidMacro |
|
| 1.5;1.5 |
1 | /* | |
2 | * VoidMacro.java | |
3 | * | |
4 | * Created on March 26, 2001, 12:33 AM | |
5 | */ | |
6 | ||
7 | package org.webmacro.engine; | |
8 | ||
9 | import org.webmacro.Context; | |
10 | import org.webmacro.FastWriter; | |
11 | import org.webmacro.Macro; | |
12 | import org.webmacro.PropertyException; | |
13 | ||
14 | import java.io.IOException; | |
15 | ||
16 | /** | |
17 | * VoidMacro doesn't output data to the output stream, but will log a | |
18 | * debug message (if debugging is turned on) when either of it's | |
19 | * methods are called.<p> | |
20 | * | |
21 | * In addition, since this is a special-case Macro, and really only | |
22 | * used by the PropertyOperator and Variable classes, we have a public | |
23 | * static field called <code>instance</code> that will return an | |
24 | * already created instance of this guy. Since it doesn't do | |
25 | * anything, we really only need 1 of them around. | |
26 | * | |
27 | * @author e_ridge | |
28 | * @since 0.96 | |
29 | */ | |
30 | 10 | public final class VoidMacro implements Macro |
31 | { | |
32 | ||
33 | 10 | public static final VoidMacro instance = new VoidMacro(); |
34 | ||
35 | public void write (FastWriter out, Context context) | |
36 | throws PropertyException, IOException | |
37 | { | |
38 | // Don't do anything. | |
39 | 41 | } |
40 | ||
41 | /** | |
42 | * Always throws a new <code>PropertyException.VoidValueException</code> | |
43 | */ | |
44 | public Object evaluate (Context context) | |
45 | throws PropertyException | |
46 | { | |
47 | // We throw VoidValueException | |
48 | 3 | throw new PropertyException.VoidValueException(); |
49 | } | |
50 | ||
51 | } |