wicket.extensions.util.resource
Class TextTemplate

java.lang.Object
  extended bywicket.util.resource.AbstractResourceStream
      extended bywicket.util.resource.AbstractStringResourceStream
          extended bywicket.extensions.util.resource.TextTemplate
All Implemented Interfaces:
wicket.util.watch.IModifiable, wicket.util.resource.IResourceStream, wicket.util.resource.IStringResourceStream, java.io.Serializable
Direct Known Subclasses:
PackagedTextTemplate, TextTemplateDecorator

public abstract class TextTemplate
extends wicket.util.resource.AbstractStringResourceStream

Represents a text template that can do variable interpolation.

Author:
Eelco Hillenius, Jonathan Locke
See Also:
Serialized Form

Constructor Summary
TextTemplate()
          Construct.
TextTemplate(java.lang.String contentType)
          Construct.
 
Method Summary
 java.lang.String asString()
           
 java.lang.String asString(java.util.Map variables)
          Interpolate the map of variables with the content and return the resulting string without replacing the content.
abstract  java.lang.String getString()
          Gets the string resource.
abstract  TextTemplate interpolate(java.util.Map variables)
          Interpolates values into this text template.
 
Methods inherited from class wicket.util.resource.AbstractStringResourceStream
close, getContentType, getInputStream, lastModifiedTime, setLastModified
 
Methods inherited from class wicket.util.resource.AbstractResourceStream
getCharset, getLocale, setCharset, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface wicket.util.resource.IResourceStream
length
 

Constructor Detail

TextTemplate

public TextTemplate()
Construct.


TextTemplate

public TextTemplate(java.lang.String contentType)
Construct.

Parameters:
contentType - The mime type of this resource, such as "image/jpeg" or "text/html".
Method Detail

asString

public java.lang.String asString(java.util.Map variables)
Interpolate the map of variables with the content and return the resulting string without replacing the content. Variables are denoted in this string by the syntax ${variableName}. The contents will be altered by replacing each variable of the form ${variableName} with the value returned by variables.getValue("variableName").

Parameters:
variables - The variables to interpolate
Returns:
the result of the interpolation

asString

public java.lang.String asString()
See Also:
AbstractResourceStream.asString()

getString

public abstract java.lang.String getString()
Gets the string resource.

Returns:
The string resource

interpolate

public abstract TextTemplate interpolate(java.util.Map variables)
Interpolates values into this text template.

Parameters:
variables - Variables to interpolate into this text template
Returns:
This for chaining


Copyright © 2004-2008 Wicket developers. All Rights Reserved.