Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java @ 6180:e30d396defa5
Datacage: Added function dc:get('var-name'). Returns content of variable var-name or NULL if not
defined. This works around resolving unknown variables.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 04 Jun 2013 15:17:19 +0200 |
parents | 4edad3e414cb |
children | 65f278bd4ef5 |
comparison
equal
deleted
inserted
replaced
6179:5297e173c272 | 6180:e30d396defa5 |
---|---|
135 | 135 |
136 addFunction("dump-variables", 0, new XPathFunction() { | 136 addFunction("dump-variables", 0, new XPathFunction() { |
137 @Override | 137 @Override |
138 public Object evaluate(List args) throws XPathFunctionException { | 138 public Object evaluate(List args) throws XPathFunctionException { |
139 return FunctionResolver.this.buildHelper.frames.dump(); | 139 return FunctionResolver.this.buildHelper.frames.dump(); |
140 } | |
141 }); | |
142 | |
143 addFunction("get", 1, new XPathFunction() { | |
144 @Override | |
145 public Object evaluate(List args) throws XPathFunctionException { | |
146 Object o = args.get(0); | |
147 if (o instanceof String) { | |
148 FunctionResolver.this.buildHelper.frames.getNull( | |
149 (String)o, StackFrames.NULL); | |
150 } | |
151 return StackFrames.NULL; | |
140 } | 152 } |
141 }); | 153 }); |
142 } | 154 } |
143 | 155 |
144 /** | 156 /** |