##### Coverage Report - org.webmacro.engine.StringMacro

Classes in this File | Line Coverage | Branch Coverage | Complexity
StringMacro |
0% | 0/8
N/A | N/A
| 1.0;1

1 |  |
     /*
2 |  |
      * Created on Mar 29, 2005
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 |  |
      * @author Keats Kirsch
14 |  |
      *
15 |  |
      */
16 |  |
     public class StringMacro implements Macro
17 |  |
     {
18 |  |
19 |  |
        /**
20 |  |
         *
21 |  |
         */
22 |  |
        //** Convenience class to evaluate a string template as a Macro *//
23 | 0 |
        private String s = "";
24 |  |
25 |  |
        public StringMacro(String text)
26 | 0 |
        {
27 | 0 |
           s = text;
28 | 0 |
        }
29 |  |
30 |  |
        /* (non-Javadoc)
31 |  |
         * @see org.webmacro.Macro#evaluate(org.webmacro.Context)
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 |  |
        /* (non-Javadoc)
42 |  |
         * @see org.webmacro.Macro#write(org.webmacro.FastWriter, org.webmacro.Context)
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 |  |
     }