org.apache.velocity.runtime.resource.util
Class StringResourceRepositoryImpl

java.lang.Object
  extended by org.apache.velocity.runtime.resource.util.StringResourceRepositoryImpl
All Implemented Interfaces:
StringResourceRepository

public class StringResourceRepositoryImpl
extends 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
protected  Map resources
          mem store
 
Constructor Summary
StringResourceRepositoryImpl()
           
 
Method Summary
 String getEncoding()
          Returns the current encoding of this repository.
 StringResource getStringResource(String name)
          get the string resource that is stored with given key
 void putStringResource(String name, String body)
          add a string resource with given key.
 void putStringResource(String name, String body, String encoding)
          add a string resource with given key.
 void removeStringResource(String name)
          delete a string resource with given key.
 void setEncoding(String encoding)
          Sets the default encoding of the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

protected Map resources
mem store

Constructor Detail

StringResourceRepositoryImpl

public StringResourceRepositoryImpl()
Method Detail

getStringResource

public StringResource getStringResource(String name)
Description copied from interface: StringResourceRepository
get the string resource that is stored with given key

Specified by:
getStringResource in interface StringResourceRepository
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(String name,
                              String body)
Description copied from interface: StringResourceRepository
add a string resource with given key.

Specified by:
putStringResource in interface StringResourceRepository
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(String name,
                              String body,
                              String encoding)
Description copied from interface: StringResourceRepository
add a string resource with given key.

Specified by:
putStringResource in interface StringResourceRepository
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(String name)
Description copied from interface: StringResourceRepository
delete a string resource with given key.

Specified by:
removeStringResource in interface StringResourceRepository
Parameters:
name - The string name to remove from the repository.
See Also:
StringResourceRepository.removeStringResource(java.lang.String)

getEncoding

public String getEncoding()
Description copied from interface: StringResourceRepository
Returns the current encoding of this repository.

Specified by:
getEncoding in interface StringResourceRepository
Returns:
The current encoding of this repository.
See Also:
StringResourceRepository.getEncoding()

setEncoding

public void setEncoding(String encoding)
Description copied from interface: StringResourceRepository
Sets the default encoding of the repository. Encodings can also be stored per template string. The default implementation does this correctly.

Specified by:
setEncoding in interface StringResourceRepository
Parameters:
encoding - The encoding to use.
See Also:
StringResourceRepository.setEncoding(java.lang.String)


Copyright © 2000-2008 The Apache Software Foundation. All Rights Reserved.