MCPcopy Create free account
hub / github.com/java-native-access/jna / getNativeLibrary

Method getNativeLibrary

src/com/sun/jna/Native.java:2038–2050  ·  view source on GitHub ↗

Get the NativeLibrary instance that is wrapped by the given Library interface instance. @param library the Library interface instance, which was created by the Native#load Native.load() method @return the wrapped NativeLibrary instance

(final Library library)

Source from the content-addressed store, hash-verified

2036 * @return the wrapped {@link NativeLibrary} instance
2037 */
2038 public static NativeLibrary getNativeLibrary(final Library library) {
2039 if(library == null) {
2040 throw new IllegalArgumentException("null passed to getNativeLibrary");
2041 }
2042 if(! Proxy.isProxyClass(library.getClass())) {
2043 throw new IllegalArgumentException("library object passed to getNativeLibrary in not a proxy");
2044 }
2045 final InvocationHandler handler = Proxy.getInvocationHandler(library);
2046 if (!(handler instanceof Library.Handler)) {
2047 throw new IllegalArgumentException("Object is not a properly initialized Library interface instance");
2048 }
2049 return ((Library.Handler) handler).getNativeLibrary();
2050 }
2051
2052 /**
2053 * Get the {@link NativeLibrary} instance to which the given "registered"

Calls 4

findDirectMappedClassMethod · 0.95
getInvocationHandlerMethod · 0.80
getNameMethod · 0.65
getMethod · 0.45