All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.template.velocity.VelocityTemplateEngine Maven / Gradle / Ivy

The newest version!
package org.zodiac.template.velocity;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;

import org.zodiac.template.base.TemplateContext;
import org.zodiac.template.base.TemplateEngine;
import org.zodiac.template.base.TemplateException;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;

/**
 * Velocity模板引擎。
 * 

* Velocity模板引擎既可以插入到TemplateService中,也可以单独使用。它提供了一组velocity原生的方法 * mergeTemplate()以及作为TemplateService插件的方法。 *

* */ public interface VelocityTemplateEngine extends TemplateEngine { String mergeTemplate(String template, Context context, String inputEncoding) throws TemplateException, IOException; void mergeTemplate(String template, Context context, OutputStream ostream, String inputEncoding, String outputEncoding) throws TemplateException, IOException; void mergeTemplate(String template, Context context, Writer writer, String inputEncoding) throws TemplateException, IOException; boolean evaluate(String template, String instring, TemplateContext context, Writer writer) throws TemplateException, IOException; boolean evaluate( String template, Reader reader, TemplateContext context, Writer writer) throws TemplateException, IOException; boolean evaluate(String template, String instring, Map contextModel, Writer writer) throws TemplateException, IOException; boolean evaluate( String template, Reader reader, Map contextModel, Writer writer) throws TemplateException, IOException; boolean evaluate(String template, String instring, Context context, Writer writer) throws TemplateException, IOException; boolean evaluate( String template, Reader reader, Context context, Writer writer) throws TemplateException, IOException; default String evaluateToString(String template, String instring, TemplateContext context) throws TemplateException, IOException { StringWriter writer = new StringWriter(); evaluate(template, instring, context, writer); return writer.toString(); } default String evaluateToString( String template, Reader reader, TemplateContext context) throws TemplateException, IOException { StringWriter writer = new StringWriter(); evaluate(template, reader, context, writer); return writer.toString(); } default String evaluateToString(String template, String instring, Map contextMode) throws TemplateException, IOException { StringWriter writer = new StringWriter(); evaluate(template, instring, contextMode, writer); return writer.toString(); } default String evaluateToString( String template, Reader reader, Map contextModel) throws TemplateException, IOException { StringWriter writer = new StringWriter(); evaluate(template, reader, contextModel, writer); return writer.toString(); } default String evaluateToString(String template, String instring, Context context) throws TemplateException, IOException { StringWriter writer = new StringWriter(); evaluate(template, instring, context, writer); return writer.toString(); } default String evaluateToString( String template, Reader reader, Context context) throws TemplateException, IOException { StringWriter writer = new StringWriter(); evaluate(template, reader, context, writer); return writer.toString(); } VelocityEngine getVelocityEngine(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy