Package freemarker.template

Examples of freemarker.template.SimpleScalar


       
    }

    static class xhtmlBI extends BuiltInForString {
        TemplateModel calculateResult(String s, Environment env) {
            return new SimpleScalar(StringUtil.XHTMLEnc(s));
        }
View Full Code Here


        }
    }

    static class xmlBI extends BuiltInForString {
        TemplateModel calculateResult(String s, Environment env) {
            return new SimpleScalar(StringUtil.XMLEnc(s));
        }
View Full Code Here

        protected abstract String encodeWithCharset(String cs) throws UnsupportedEncodingException;
   
        public Object exec(List args) throws TemplateModelException {
            parent.checkMethodArgCount(args.size(), 1);
            try {
                return new SimpleScalar(encodeWithCharset((String) args.get(0)));
            } catch (UnsupportedEncodingException e) {
                throw new _TemplateModelException(e, "Failed to execute URL encoding.");
            }
        }
View Full Code Here

                    Matcher matcher = pattern.matcher(s);
                    result = (flags & RegexpHelper.RE_FLAG_FIRST_ONLY) != 0
                            ? matcher.replaceFirst(arg2)
                            : matcher.replaceAll(arg2);
                }
                return new SimpleScalar(result);
            }
View Full Code Here

              
                entireInputMatchGroups = new TemplateSequenceModel() {
                   
                    public TemplateModel get(int i) throws TemplateModelException {
                        try {
                            return new SimpleScalar(firedEntireInputMatcher.group(i));
                        } catch (Exception e) {
                            throw new _TemplateModelException(e, "Failed to read match group");
                        }
                    }
                   
View Full Code Here

    void accept(Environment env) throws TemplateException, IOException {
        if (nestedBlock != null) {
            env.visitAndTransform(nestedBlock, new CaptureOutput(env), null);
        } else {
      TemplateModel value = new SimpleScalar("");
      if (namespaceExp != null) {
        Environment.Namespace ns = (Environment.Namespace) namespaceExp.eval(env);
        ns.put(varName, value);
       } else if (scope == Assignment.NAMESPACE) {
        env.setVariable(varName, value);
View Full Code Here

        }
       
        public Writer getWriter(Writer out, Map args) {
            return new StringWriter() {
                public void close() {
                    SimpleScalar result = new SimpleScalar(toString());
                    switch(scope) {
                        case Assignment.NAMESPACE: {
                            if(fnsModel != null) {
                                fnsModel.put(varName, result);
                            }
View Full Code Here

                if (hadItem) {
                    if (afterLast != null) sb.append(afterLast);
                } else {
                    if (whenEmpty != null) sb.append(whenEmpty);
                }
                return new SimpleScalar(sb.toString());
           }
View Full Code Here

       }
    }
   
    static class node_nameBI extends BuiltInForNode {
       TemplateModel calculateResult(TemplateNodeModel nodeModel, Environment env) throws TemplateModelException {
            return new SimpleScalar(nodeModel.getNodeName());
       }
View Full Code Here

   
   
    static class node_namespaceBI extends BuiltInForNode {
        TemplateModel calculateResult(TemplateNodeModel nodeModel, Environment env) throws TemplateModelException {
            String nsURI = nodeModel.getNodeNamespace();
            return nsURI == null ? null : new SimpleScalar(nsURI);
        }
View Full Code Here

TOP

Related Classes of freemarker.template.SimpleScalar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.