org.apache.commons.resources.impl
Class TestResources

java.lang.Object
  extended by org.apache.commons.resources.impl.ResourcesBase
      extended by org.apache.commons.resources.impl.TestResources
All Implemented Interfaces:
Serializable, org.apache.commons.resources.Resources

public class TestResources
extends org.apache.commons.resources.impl.ResourcesBase

Concrete implementation of Resources for unit tests.

See Also:
Serialized Form

Field Summary
protected  boolean initialized
           
protected  Map map
           
 
Constructor Summary
TestResources(String name)
           
 
Method Summary
 void destroy()
           
 Iterator getKeys()
           
 Object getObject(String key)
          Return the content for the specified key as an Object, localized based on the specified locale.
 Object getObject(String key, Locale locale)
           
 void init()
           
 boolean isInitialized()
           
 
Methods inherited from class org.apache.commons.resources.impl.ResourcesBase
getBufferSize, getBytes, getInputStream, getName, getReader, getString, isReturnNull, setBufferSize, setReturnNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

protected boolean initialized

map

protected Map map
Constructor Detail

TestResources

public TestResources(String name)
Method Detail

init

public void init()
          throws org.apache.commons.resources.ResourcesException
Specified by:
init in interface org.apache.commons.resources.Resources
Overrides:
init in class org.apache.commons.resources.impl.ResourcesBase
Throws:
org.apache.commons.resources.ResourcesException

destroy

public void destroy()
             throws org.apache.commons.resources.ResourcesException
Specified by:
destroy in interface org.apache.commons.resources.Resources
Overrides:
destroy in class org.apache.commons.resources.impl.ResourcesBase
Throws:
org.apache.commons.resources.ResourcesException

getKeys

public Iterator getKeys()
Specified by:
getKeys in interface org.apache.commons.resources.Resources
Specified by:
getKeys in class org.apache.commons.resources.impl.ResourcesBase

isInitialized

public boolean isInitialized()

getObject

public Object getObject(String key)

Return the content for the specified key as an Object, localized based on the specified locale.

Parameters:
key - Identifier for the requested content
locale - Locale with which to localize retrieval, or null for the default Locale
Throws:
org.apache.commons.resources.ResourcesException - if an error occurs retrieving or returning the requested content

getObject

public Object getObject(String key,
                        Locale locale)
                 throws org.apache.commons.resources.ResourcesException
Specified by:
getObject in interface org.apache.commons.resources.Resources
Specified by:
getObject in class org.apache.commons.resources.impl.ResourcesBase
Throws:
org.apache.commons.resources.ResourcesException


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.