Package freemarker.template

Examples of freemarker.template.SimpleScalar


        protected TemplateModel calculateResult(
                Date date, int dateType, Environment env)
        throws TemplateException {
            checkDateTypeNotUnknown(dateType, env);
            return new SimpleScalar(DateUtil.dateToISO8601String(
                    date,
                    dateType != TemplateDateModel.TIME,
                    dateType != TemplateDateModel.DATE,
                    showOffset && dateType != TemplateDateModel.DATE,
                    accuracy,
View Full Code Here


                            "java.util.TimeZone but it was a " +
                            (tzArgTM != null ? tzArgTM.getClass().getName() : "null") +
                            ".");
                }
               
                return new SimpleScalar(DateUtil.dateToISO8601String(
                        date,
                        dateType != TemplateDateModel.TIME,
                        dateType != TemplateDateModel.DATE,
                        showOffset && dateType != TemplateDateModel.DATE,
                        accuracy,
View Full Code Here

        {
            TemplateModel model = target.getAsTemplateModel(env);
            Number num = EvaluationUtil.getNumber(model, target, env);
            if (num instanceof Integer) {
                // We accelerate this fairly common case
                return new SimpleScalar(num.toString());
            } else {
                return new SimpleScalar(env.getCNumberFormat().format(num));
            }
        }
View Full Code Here

    void accept(Environment env) throws TemplateException, IOException {
        if (nestedBlock != null) {
            env.visit(nestedBlock, new CaptureOutput(env), null);
        } else {
      TemplateModel value = new SimpleScalar("");
      if (namespaceExp != null) {
        Environment.Namespace ns = (Environment.Namespace) namespaceExp.getAsTemplateModel(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 (array == null) {
            array = new TemplateScalarModel[stringArray.length];
        }
        TemplateScalarModel result = array[index];
        if (result == null) {
            result = new SimpleScalar(stringArray[index]);
            array[index] = result;
        }
        return result;
    }
View Full Code Here

        }
       
        public TemplateModel get(String key) throws TemplateModelException
        {
            String s = configurable.getSetting(key);
            return s == null ? null : new SimpleScalar(s);
        }
View Full Code Here

        private final SimpleScalar name;

        DebugTemplateModel(Template template)
        {
            super(template);
            this.name = new SimpleScalar(template.getName());
        }
View Full Code Here

      if (arguments.size() > 1 && arguments.get(1) != null) {
        sqlColumnName += formatter.run(arguments.get(1).toString());
      }
    }
    try {
      return new SimpleScalar(sqlColumnName);
    } catch (Exception ex) {
      throw new TemplateModelException("Could not infer SQL column name.", ex);
    }
  }
View Full Code Here

     *         a missing variables is usually considered as an error in the FreeMarker
     *         Template Language, so the usage of a bad index will not remain hidden.
     */
    public TemplateModel get(int index) throws TemplateModelException {
        try {
            return new SimpleScalar(values[index].getString());
        } catch (RepositoryException e) {
            throw new TemplateModelException(e);
        }
    }
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.