com.jniwrapper.util
Class FunctionCache

java.lang.Object
  extended by com.jniwrapper.util.FunctionCache

public class FunctionCache
extends java.lang.Object

Allows to cache softly-referenced Function instances, which provides automatic removal of unreferenced instances under low memory conditions. When initialized with a library name, the cache automatically creates the library instance.

See Also:
SoftCache

Constructor Summary
FunctionCache(Library library)
          Creates a cache that uses the passed library instance.
FunctionCache(java.lang.String libraryName)
          Creates a cache for the library with the passed name.
 
Method Summary
 Function getFunction(java.lang.String name)
          Gets a function specified by the name in the cache, or queries the function instance from the associated library, and caches it for subsequent requests.
 void getVariable(java.lang.String name, Parameter variable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionCache

public FunctionCache(java.lang.String libraryName)
Creates a cache for the library with the passed name. The actual library instance will be created for the passed name on demand.

Parameters:
libraryName - a name of the library.
Throws:
java.lang.IllegalArgumentException - of the passed value is null or empty string.

FunctionCache

public FunctionCache(Library library)
Creates a cache that uses the passed library instance.

Parameters:
library - a library to be used by the cache.
Throws:
java.lang.NullPointerException - if the passed library instance is null.
Method Detail

getFunction

public Function getFunction(java.lang.String name)
Gets a function specified by the name in the cache, or queries the function instance from the associated library, and caches it for subsequent requests.

Parameters:
name - the name of the function to get.
Returns:
non-null Function instance.
Throws:
NoSuchFunctionException - if a function is not found in the associated library.

getVariable

public void getVariable(java.lang.String name,
                        Parameter variable)