org.apache.tiles.velocity.context
Class VelocityUtil

Package class diagram package VelocityUtil
java.lang.Object
  extended by org.apache.tiles.velocity.context.VelocityUtil

public final class VelocityUtil
extends Object

Utilities for Velocity usage in Tiles.

Since:
2.2.0
Version:
$Rev: 797765 $ $Date: 2009-07-25 15:20:26 +0200 (sab, 25 lug 2009) $

Field Summary
static org.apache.velocity.runtime.Renderable EMPTY_RENDERABLE
          A renderable object that does not render anything.
 
Method Summary
static ArrayStack<Map<String,Object>> getParameterStack(org.apache.velocity.context.Context context)
          Returns or creates the parameter stack to use.
static void setAttribute(org.apache.velocity.context.Context velocityContext, HttpServletRequest request, ServletContext servletContext, String name, Object obj, String scope)
          Sets an attribute in the desired scope.
static boolean toSimpleBoolean(Boolean obj, boolean defaultValue)
          Null-safe conversion from Boolean to boolean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_RENDERABLE

public static final org.apache.velocity.runtime.Renderable EMPTY_RENDERABLE
A renderable object that does not render anything.

Since:
2.2.0
Method Detail

toSimpleBoolean

public static boolean toSimpleBoolean(Boolean obj,
                                      boolean defaultValue)
Null-safe conversion from Boolean to boolean.

Parameters:
obj - The Boolean object.
defaultValue - This value will be returned if obj is null.
Returns:
The boolean value of obj or, if null, defaultValue.
Since:
2.2.0

getParameterStack

public static ArrayStack<Map<String,Object>> getParameterStack(org.apache.velocity.context.Context context)
Returns or creates the parameter stack to use. It is useful to store parameters across tool calls.

Parameters:
context - The Velocity context.
Returns:
The parameter stack.
Since:
2.2.0

setAttribute

public static void setAttribute(org.apache.velocity.context.Context velocityContext,
                                HttpServletRequest request,
                                ServletContext servletContext,
                                String name,
                                Object obj,
                                String scope)
Sets an attribute in the desired scope.

Parameters:
velocityContext - The Velocity context.
request - The HTTP request.
servletContext - The servlet context.
name - The name of the attribute.
obj - The value of the attribute.
scope - The scope. It can be page, request , session, application.
Since:
2.2.0


Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.