01: package org.obe.sql;
02:
03: import java.io.IOException;
04: import java.io.Writer;
05:
06: /**
07: * @author Adrian Price
08: */
09: public class SQLPattern extends SimpleNode {
10: Object value;
11:
12: public SQLPattern(int id) {
13: super (id);
14: }
15:
16: public void setValue(String s) {
17: value = s.substring(1, s.length() - 1);
18: }
19:
20: public void write(Writer out) throws IOException {
21: if (value == null && children != null && children.length == 1) {
22: children[0].write(out);
23: } else {
24: out.write('\'');
25: out.write(value.toString());
26: out.write('\'');
27: }
28: }
29:
30: public Object execute(Object context) {
31: return value == null && children != null
32: && children.length == 1 ? children[0].execute(context)
33: : value;
34: }
35: }
|