Class StringResource
- java.lang.Object
-
- org.apache.velocity.runtime.resource.util.StringResource
-
public final class StringResource extends java.lang.ObjectWrapper for Strings containing templates, allowing to add additional meta data like timestamps.- Since:
- 1.5
- Version:
- $Id: StringResource.java 685685 2008-08-13 21:43:27Z nbubna $
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringbodytemplate bodyprivate java.lang.Stringencodingencodingprivate longlastModifiedlast modified ts
-
Constructor Summary
Constructors Constructor Description StringResource(java.lang.String body, java.lang.String encoding)convenience constructor; sets body to 'body' and sets lastModified to now
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBody()Sets the template body.java.lang.StringgetEncoding()Returns the encoding of this String resource.longgetLastModified()Returns the modification date of the template.voidsetBody(java.lang.String body)Sets a new value for the template body.voidsetEncoding(java.lang.String encoding)Sets the encoding of this string resource.voidsetLastModified(long lastModified)Changes the last modified parameter.
-
-
-
Method Detail
-
getBody
public java.lang.String getBody()
Sets the template body.- Returns:
- String containing the template body.
-
getLastModified
public long getLastModified()
Returns the modification date of the template.- Returns:
- Modification date in milliseconds.
-
setBody
public void setBody(java.lang.String body)
Sets a new value for the template body.- Parameters:
body- New body value
-
setLastModified
public void setLastModified(long lastModified)
Changes the last modified parameter.- Parameters:
lastModified- The modification time in millis.
-
getEncoding
public java.lang.String getEncoding()
Returns the encoding of this String resource.- Returns:
- The encoding of this String resource.
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding of this string resource.- Parameters:
encoding- The new encoding of this resource.
-
-