public abstract class TextTemplate extends AbstractStringResourceStream
VariableInterpolator
,
Serialized FormDEFAULT_CONTENT_TYPE
Constructor and Description |
---|
TextTemplate()
Constructor.
|
TextTemplate(String contentType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
asString() |
String |
asString(Map<String,?> variables)
Interpolates the
Map of variables with the content and returns the resulting
String without replacing the content. |
abstract String |
getString()
Retrieves the
String resource. |
abstract TextTemplate |
interpolate(Map<String,?> variables)
Interpolates values into this
TextTemplate . |
close, getCharset, getContentType, getInputStream, lastModifiedTime, length, setCharset, setLastModified
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
public TextTemplate()
public TextTemplate(String contentType)
contentType
- the mime type of this resource, such as "image/jpeg
" or "
text/html
"public String asString(Map<String,?> variables)
Map
of variables with the content and returns 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")
.variables
- the variables to interpolatepublic String asString()
asString
in interface IStringResourceStream
asString
in class AbstractStringResourceStream
AbstractStringResourceStream.asString()
public abstract String getString()
String
resource.getString
in class AbstractStringResourceStream
String
resourcepublic abstract TextTemplate interpolate(Map<String,?> variables)
TextTemplate
.variables
- variables to interpolate into this TextTemplate
this
, for chaining purposesCopyright © 2006–2019 Apache Software Foundation. All rights reserved.