01: package org.ztemplates.actions.urlhandler.tree.match;
02:
03: import org.ztemplates.actions.util.ZFormatUtil;
04:
05: public class ZSegmentLiteral extends ZSegment {
06: private final String text;
07:
08: public ZSegmentLiteral(String text) {
09: super ();
10: this .text = text;
11: }
12:
13: public String getText() {
14: return text;
15: }
16:
17: @Override
18: public void toXml(StringBuffer sb, int depth) {
19: ZFormatUtil.indent(sb, depth);
20: sb.append("<literal>");
21: sb.append(text);
22: sb.append("</literal>");
23: }
24:
25: @Override
26: public boolean isMatchingTheSame(ZSegment other) {
27: if (other instanceof ZSegmentLiteral) {
28: ZSegmentLiteral sl = (ZSegmentLiteral) other;
29: return text.equals(sl.text);
30: }
31: return false;
32: }
33:
34: @Override
35: public String toDefinition() {
36: return text;
37: }
38: }
|