All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jnr.ffi.provider.InvalidProvider Maven / Gradle / Ivy

The newest version!
package jnr.ffi.provider;

import jnr.ffi.*;
import jnr.ffi.Runtime;

import java.util.Collection;
import java.util.Map;

final class InvalidProvider extends FFIProvider {
    private final String message;
    private final Throwable cause;
    private final jnr.ffi.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  LibraryLoader createLibraryLoader(Class interfaceClass) {
        return new LibraryLoader(interfaceClass) {
            @Override
            protected T loadLibrary(Class interfaceClass, Collection libraryNames, Collection searchPaths, Map options) {
                UnsatisfiedLinkError error = new UnsatisfiedLinkError(message);
                error.initCause(cause);
                throw error;
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy