jnr.ffi.InvalidProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jnr-ffi Show documentation
Show all versions of jnr-ffi Show documentation
A library for invoking native functions from java
package jnr.ffi;
import java.util.Map;
final class InvalidProvider extends FFIProvider {
private final String message;
private final Throwable cause;
private final Runtime runtime;
InvalidProvider(String message, Throwable cause) {
this.message = message;
this.cause = cause;
this.runtime = new InvalidRuntime(message, cause);
}
@Override
public Runtime getRuntime() {
return runtime;
}
@Override
public T loadLibrary(String libraryName, Class interfaceClass, Map libraryOptions) {
throw newLoadError();
}
@Override
public T loadLibrary(Class interfaceClass, Map libraryOptions, String... libraryNames) {
throw newLoadError();
}
private UnsatisfiedLinkError newLoadError() {
UnsatisfiedLinkError error = new UnsatisfiedLinkError(message);
error.initCause(cause);
throw error;
}
}