Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2014 Attila Szegedi, Daniel Dekany, Jonathan Revusky
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 22 October 1999: This class added by Holger Arendt.
package freemarker.template;
"method" template language data type: Objects that act like functions. The name comes from that their original application was calling Java methods via freemarker.ext.beans.BeansWrapper.

In templates they are used like myMethod("foo", "bar") or myJavaObject.myJavaMethod("foo", "bar").

Use TemplateMethodModelEx instead. This interface is from the old times when the only kind of value you could pass in was string.
public interface TemplateMethodModel extends TemplateModel {

Executes the method call. All arguments passed to the method call are coerced to strings before being passed, if the FreeMarker rules allow the coercion. If some of the passed arguments can not be coerced to a string, an exception will be raised in the engine and the method will not be called. If your method would like to act on actual data model objects instead of on their string representations, implement the TemplateMethodModelEx instead.

arguments a List of String objects containing the values of the arguments passed to the method.
the return value of the method, or null. If the returned value does not implement TemplateModel, it will be automatically wrapped using the environment object wrapper.
    public Object exec(List argumentsthrows TemplateModelException;
New to GrepCode? Check out our FAQ X