com.google.clearsilver.jsilver.resourceloader
Class BaseResourceLoader

java.lang.Object
  extended by com.google.clearsilver.jsilver.resourceloader.BaseResourceLoader
All Implemented Interfaces:
ResourceLoader
Direct Known Subclasses:
BufferedResourceLoader, InMemoryResourceLoader

public abstract class BaseResourceLoader
extends Object
implements ResourceLoader

Implementations of ResourceLoader should extend this class rather than directly implement the ResourceLoader interface - this allows changes to be made to the ResourceLoader interface whilst retaining backwards compatibility with existing implementations.

See Also:
ResourceLoader

Constructor Summary
BaseResourceLoader()
           
 
Method Summary
 void close(Reader reader)
          Close the reader.
 Object getKey(String filename)
          Default implementation returns the filename as the ResourceLoaders that subclass this class tend to assume they are the only ResourceLoader in use.
 Object getResourceVersionId(String filename)
          Default implementation does not check whether the resource has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.clearsilver.jsilver.resourceloader.ResourceLoader
open, openOrFail
 

Constructor Detail

BaseResourceLoader

public BaseResourceLoader()
Method Detail

close

public void close(Reader reader)
           throws IOException
Description copied from interface: ResourceLoader
Close the reader. Allows ResourceLoader to perform any additional clean up.

Specified by:
close in interface ResourceLoader
Parameters:
reader - the reader to close
Throws:
IOException - if reader fasils to close

getKey

public Object getKey(String filename)
Default implementation returns the filename as the ResourceLoaders that subclass this class tend to assume they are the only ResourceLoader in use. Or at least that the filename is the only necessary form of uniqueness between two instances of this same ResourceLoader.

Specified by:
getKey in interface ResourceLoader
Parameters:
filename - the name we want to identify
Returns:
unique identifier

getResourceVersionId

public Object getResourceVersionId(String filename)
Default implementation does not check whether the resource has changed.

Specified by:
getResourceVersionId in interface ResourceLoader
Parameters:
filename - the name of the resource to check for resources
Returns:
unique identifier for the current version of the resource or null if the resource cannot be found


Copyright © 2010-2012 Google. All Rights Reserved.