Top Description Fields Constructors Methods
uk.ac.ed.ph.snuggletex.utilities

public Class SimpleStylesheetCache

extends Object
implements StylesheetCache
Class Inheritance
All Implemented Interfaces
uk.ac.ed.ph.snuggletex.utilities.StylesheetCache
Imports
uk.ac.ed.ph.snuggletex.SnuggleEngine, java.util.HashMap, .Map, javax.xml.transform.Templates

Trivial implementation of StylesheetCache that simply caches all stylesheets in a HashMap.

This is used internally by SnuggleEngine and certain extensions. It might also be useful in other very simple situations.

Field Summary

Modifier and TypeField and Description
private final Map<String, Templates>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Templates
getStylesheet(String key)

Implements uk.ac.ed.ph.snuggletex.utilities.StylesheetCache.getStylesheet.

Tries to retrieve an XSLT stylesheet from the cache having the given key.

public void
putStylesheet(String key, Templates stylesheet)

Implements uk.ac.ed.ph.snuggletex.utilities.StylesheetCache.putStylesheet.

Instructs the cache that it might want to store the given XSLT stylesheet corresponding to the given key.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cacheMapback to summary
private final Map<String, Templates> cacheMap

Constructor Detail

SimpleStylesheetCacheback to summary
public SimpleStylesheetCache()

Method Detail

getStylesheetback to summary
public Templates getStylesheet(String key)

Implements uk.ac.ed.ph.snuggletex.utilities.StylesheetCache.getStylesheet.

Doc from uk.ac.ed.ph.snuggletex.utilities.StylesheetCache.getStylesheet.

Tries to retrieve an XSLT stylesheet from the cache having the given key.

Return a previously cached Templates or null if your cache doesn't want to cache this or if it does not contain the required result.

putStylesheetback to summary
public void putStylesheet(String key, Templates stylesheet)

Implements uk.ac.ed.ph.snuggletex.utilities.StylesheetCache.putStylesheet.

Doc from uk.ac.ed.ph.snuggletex.utilities.StylesheetCache.putStylesheet.

Instructs the cache that it might want to store the given XSLT stylesheet corresponding to the given key.

Implementations can safely choose to do absolutely nothing here if they want.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override