@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2006 the original author or authors .
* Copyright 2002 - 2012 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -42,15 +42,16 @@ public abstract class VelocityEngineUtils {
@@ -42,15 +42,16 @@ public abstract class VelocityEngineUtils {
* Merge the specified Velocity template with the given model and write
* the result to the given Writer .
* @param velocityEngine VelocityEngine to work with
* @param templateLocation the location of template , relative to Velocity ' s
* resource loader path
* @param model the Map that contains model names as keys and model objects
* as values
* @param templateLocation the location of template , relative to Velocity ' s resource loader path
* @param model the Map that contains model names as keys and model objects as values
* @param writer the Writer to write the result to
* @throws VelocityException if the template wasn ' t found or rendering failed
* @deprecated Use { @link # mergeTemplate ( VelocityEngine , String , String , Map , Writer ) }
* instead , following Velocity 1 . 6 ' s corresponding deprecation in its own API .
* /
@Deprecated
public static void mergeTemplate (
VelocityEngine velocityEngine , String templateLocation , Map model , Writer writer )
VelocityEngine velocityEngine , String templateLocation , Map < String , Object > model , Writer writer )
throws VelocityException {
try {
@ -70,20 +71,18 @@ public abstract class VelocityEngineUtils {
@@ -70,20 +71,18 @@ public abstract class VelocityEngineUtils {
}
/ * *
* Merge the specified Velocity template with the given model and write
* the result t o the given Writer .
* Merge the specified Velocity template with the given model and write the result
* to the given Writer .
* @param velocityEngine VelocityEngine to work with
* @param templateLocation the location of template , relative to Velocity ' s
* resource loader path
* @param templateLocation the location of template , relative to Velocity ' s resource loader path
* @param encoding the encoding of the template file
* @param model the Map that contains model names as keys and model objects
* as values
* @param model the Map that contains model names as keys and model objects as values
* @param writer the Writer to write the result to
* @throws VelocityException if the template wasn ' t found or rendering failed
* /
public static void mergeTemplate (
VelocityEngine velocityEngine , String templateLocation , String encoding , Map model , Writer writer )
throws VelocityException {
VelocityEngine velocityEngine , String templateLocation , String encoding ,
Map < String , Object > model , Writer writer ) throws VelocityException {
try {
VelocityContext velocityContext = new VelocityContext ( model ) ;
@ -106,17 +105,17 @@ public abstract class VelocityEngineUtils {
@@ -106,17 +105,17 @@ public abstract class VelocityEngineUtils {
* < p > When using this method to prepare a text for a mail to be sent with Spring ' s
* mail support , consider wrapping VelocityException in MailPreparationException .
* @param velocityEngine VelocityEngine to work with
* @param templateLocation the location of template , relative to Velocity ' s
* resource loader path
* @param model the Map that contains model names as keys and model objects
* as values
* @param templateLocation the location of template , relative to Velocity ' s resource loader path
* @param model the Map that contains model names as keys and model objects as values
* @return the result as String
* @throws VelocityException if the template wasn ' t found or rendering failed
* @see org . springframework . mail . MailPreparationException
* @deprecated Use { @link # mergeTemplateIntoString ( VelocityEngine , String , String , Map ) }
* instead , following Velocity 1 . 6 ' s corresponding deprecation in its own API .
* /
public static String mergeTemplateIntoString (
VelocityEngine velocityEngine , String templateLocation , Map model )
throws VelocityException {
@Deprecated
public static String mergeTemplateIntoString ( VelocityEngine velocityEngine , String templateLocation ,
Map < String , Object > model ) throws VelocityException {
StringWriter result = new StringWriter ( ) ;
mergeTemplate ( velocityEngine , templateLocation , model , result ) ;
@ -128,18 +127,15 @@ public abstract class VelocityEngineUtils {
@@ -128,18 +127,15 @@ public abstract class VelocityEngineUtils {
* < p > When using this method to prepare a text for a mail to be sent with Spring ' s
* mail support , consider wrapping VelocityException in MailPreparationException .
* @param velocityEngine VelocityEngine to work with
* @param templateLocation the location of template , relative to Velocity ' s
* resource loader path
* @param templateLocation the location of template , relative to Velocity ' s resource loader path
* @param encoding the encoding of the template file
* @param model the Map that contains model names as keys and model objects
* as values
* @param model the Map that contains model names as keys and model objects as values
* @return the result as String
* @throws VelocityException if the template wasn ' t found or rendering failed
* @see org . springframework . mail . MailPreparationException
* /
public static String mergeTemplateIntoString (
VelocityEngine velocityEngine , String templateLocation , String encoding , Map model )
throws VelocityException {
public static String mergeTemplateIntoString ( VelocityEngine velocityEngine , String templateLocation ,
String encoding , Map < String , Object > model ) throws VelocityException {
StringWriter result = new StringWriter ( ) ;
mergeTemplate ( velocityEngine , templateLocation , encoding , model , result ) ;