| 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 | 0 | private String s = ""; |
| 24 | |
|
| 25 | |
public StringMacro(String text) |
| 26 | 0 | { |
| 27 | 0 | s = text; |
| 28 | 0 | } |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
public Object evaluate(Context context) |
| 34 | |
throws org.webmacro.PropertyException |
| 35 | |
{ |
| 36 | 0 | org.webmacro.engine.StringTemplate t = |
| 37 | |
new org.webmacro.engine.StringTemplate(context.getBroker(), s); |
| 38 | 0 | 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 | 0 | fw.write((String) evaluate(context)); |
| 48 | 0 | } |
| 49 | |
} |