Package freemarker.template

Examples of freemarker.template.TemplateMethodModelEx


       
        TemplateModel a = e.get("A");
        assertTrue(a instanceof TemplateScalarModel);
        assertTrue(a instanceof TemplateHashModel);
        assertEquals(((TemplateScalarModel) a).getAsString(), "ts:A");
        TemplateMethodModelEx nameMethod = (TemplateMethodModelEx) ((TemplateHashModel) a).get("name");
        assertEquals(((TemplateScalarModel) nameMethod.exec(new ArrayList())).getAsString(), "A");
       
        assertSame(e, enums.get(E.class.getName()));
       
        bw.clearClassIntrospecitonCache();
        TemplateHashModel eAfterClean = (TemplateHashModel) enums.get(E.class.getName());
View Full Code Here


    }

    static class substringBI extends BuiltInForString {
       
        TemplateModel calculateResult(final String s, final Environment env) throws TemplateException {
            return new TemplateMethodModelEx() {
               
                public Object exec(java.util.List args) throws TemplateModelException {
                    int argCount = args.size();
                    checkMethodArgCount(argCount, 1, 2);
   
View Full Code Here

    public static final class DefaultBuiltIn extends ExistenceBuiltIn {
        public TemplateModel apply(final TemplateModel model) {
            if(model == null || model == TemplateModel.JAVA_NULL) {
                return FirstDefined.INSTANCE;
            }
            return new TemplateMethodModelEx() {
                public Object exec(List arguments) {
                    return model;
                }
            };
        }
View Full Code Here

TOP

Related Classes of freemarker.template.TemplateMethodModelEx

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.