1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
package org.webmacro.engine; |
6 | |
|
7 | |
import java.io.IOException; |
8 | |
|
9 | |
import org.webmacro.Context; |
10 | |
import org.webmacro.Macro; |
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
public class StringMacro implements Macro |
17 | |
{ |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | 14 | private String s = ""; |
24 | |
|
25 | |
public StringMacro(String text) |
26 | 14 | { |
27 | 14 | s = text; |
28 | 14 | } |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public Object evaluate(Context context) |
34 | |
throws org.webmacro.PropertyException |
35 | |
{ |
36 | 11 | org.webmacro.engine.StringTemplate t = |
37 | |
new org.webmacro.engine.StringTemplate(context.getBroker(), s); |
38 | 11 | return t.evaluateAsString(context); |
39 | |
} |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
public void write(org.webmacro.FastWriter fw, Context context) |
45 | |
throws org.webmacro.PropertyException, IOException |
46 | |
{ |
47 | 11 | fw.write((String) evaluate(context)); |
48 | 11 | } |
49 | |
} |