com.kenai.jaffl

Class Library

public final class Library extends Object

Method Summary
static voidaddLibraryPath(String libraryName, File path)
Adds a custom search path for a library
static LibrarygetInstance(String libraryName)
static List<String>getLibraryPath(String libraryName)
Gets the custom search path for a library.
StringgetName()
Gets the name of this library
booleanhasFunction(String function)
Checks if a specific function exists in the library.
static <T> TloadLibrary(String libraryName, Class<T> interfaceClass)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.
static <T> TloadLibrary(Class<T> interfaceClass, String... libraryNames)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.
static <T> TloadLibrary(String libraryName, Class<T> interfaceClass, Map<LibraryOption,?> libraryOptions)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.
static <T> TloadLibrary(Class<T> interfaceClass, Map<LibraryOption,?> libraryOptions, String... libraryNames)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.

Method Detail

addLibraryPath

public static final void addLibraryPath(String libraryName, File path)
Adds a custom search path for a library

Parameters: libraryName the name of the library to search for path the path to search for the library in

getInstance

public static final Library getInstance(String libraryName)

getLibraryPath

public static List<String> getLibraryPath(String libraryName)
Gets the custom search path for a library.

Parameters: libraryName The library to retrieve the path for.

Returns: A List of String instances.

getName

public String getName()
Gets the name of this library

Returns: The name of this library as a String

hasFunction

public boolean hasFunction(String function)

Deprecated: this method is no longer supported.

Checks if a specific function exists in the library.

Parameters: function The function

Returns: true if the function exists

loadLibrary

public static <T> T loadLibrary(String libraryName, Class<T> interfaceClass)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.

Parameters: libraryName the name of the library to load interfaceClass the interface that describes the native library interface

Returns: an instance of {@code interfaceclass} that will call the native methods.

loadLibrary

public static <T> T loadLibrary(Class<T> interfaceClass, String... libraryNames)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.

Parameters: libraryName the name of the library to load interfaceClass the interface that describes the native library interface

Returns: an instance of {@code interfaceclass} that will call the native methods.

loadLibrary

public static <T> T loadLibrary(String libraryName, Class<T> interfaceClass, Map<LibraryOption,?> libraryOptions)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.

Parameters: libraryName the name of the library to load interfaceClass the interface that describes the native library interface libraryOptions options

Returns: an instance of {@code interfaceclass} that will call the native methods.

loadLibrary

public static <T> T loadLibrary(Class<T> interfaceClass, Map<LibraryOption,?> libraryOptions, String... libraryNames)
Loads a native library and links the methods defined in {@code interfaceClass} to native methods in the library.

Parameters: libraryName the name of the library to load interfaceClass the interface that describes the native library interface libraryOptions options

Returns: an instance of {@code interfaceclass} that will call the native methods.