Class StringResourceRepositoryImpl
- java.lang.Object
-
- org.apache.velocity.runtime.resource.util.StringResourceRepositoryImpl
-
- All Implemented Interfaces:
StringResourceRepository
public class StringResourceRepositoryImpl extends java.lang.Object implements StringResourceRepository
Default implementation of StringResourceRepository. Uses a HashMap for storage- Since:
- 1.5
- Version:
- $Id: StringResourceRepositoryImpl.java 685724 2008-08-13 23:12:12Z nbubna $
- Author:
- Eelco Hillenius, Henning P. Schmiedehausen
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Mapresourcesmem store
-
Constructor Summary
Constructors Constructor Description StringResourceRepositoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEncoding()Returns the current encoding of this repository.StringResourcegetStringResource(java.lang.String name)get the string resource that is stored with given keyvoidputStringResource(java.lang.String name, java.lang.String body)add a string resource with given key.voidputStringResource(java.lang.String name, java.lang.String body, java.lang.String encoding)add a string resource with given key.voidremoveStringResource(java.lang.String name)delete a string resource with given key.voidsetEncoding(java.lang.String encoding)Sets the default encoding of the repository.
-
-
-
Method Detail
-
getStringResource
public StringResource getStringResource(java.lang.String name)
Description copied from interface:StringResourceRepositoryget the string resource that is stored with given key- Specified by:
getStringResourcein interfaceStringResourceRepository- Parameters:
name- String name to retrieve from the repository.- Returns:
- A StringResource containing the template.
- See Also:
StringResourceRepository.getStringResource(java.lang.String)
-
putStringResource
public void putStringResource(java.lang.String name, java.lang.String body)Description copied from interface:StringResourceRepositoryadd a string resource with given key.- Specified by:
putStringResourcein interfaceStringResourceRepository- Parameters:
name- The String name to store the template under.body- A String containing a template.- See Also:
StringResourceRepository.putStringResource(java.lang.String, java.lang.String)
-
putStringResource
public void putStringResource(java.lang.String name, java.lang.String body, java.lang.String encoding)Description copied from interface:StringResourceRepositoryadd a string resource with given key.- Specified by:
putStringResourcein interfaceStringResourceRepository- Parameters:
name- The String name to store the template under.body- A String containing a template.encoding- The encoding of this string template- Since:
- 1.6
- See Also:
StringResourceRepository.putStringResource(java.lang.String, java.lang.String, java.lang.String)
-
removeStringResource
public void removeStringResource(java.lang.String name)
Description copied from interface:StringResourceRepositorydelete a string resource with given key.- Specified by:
removeStringResourcein interfaceStringResourceRepository- Parameters:
name- The string name to remove from the repository.- See Also:
StringResourceRepository.removeStringResource(java.lang.String)
-
getEncoding
public java.lang.String getEncoding()
Description copied from interface:StringResourceRepositoryReturns the current encoding of this repository.- Specified by:
getEncodingin interfaceStringResourceRepository- Returns:
- The current encoding of this repository.
- See Also:
StringResourceRepository.getEncoding()
-
setEncoding
public void setEncoding(java.lang.String encoding)
Description copied from interface:StringResourceRepositorySets the default encoding of the repository. Encodings can also be stored per template string. The default implementation does this correctly.- Specified by:
setEncodingin interfaceStringResourceRepository- Parameters:
encoding- The encoding to use.- See Also:
StringResourceRepository.setEncoding(java.lang.String)
-
-