refactor(java-sdk): Revise API usage (#177)

(cherry picked from commit 766090a1aa8340598c643ca01dded16b15c26ba5)
This commit is contained in:
Thomas Darimont
2022-12-20 00:48:45 +01:00
committed by GitHub
parent 9ccef562a9
commit 322812ede2
3 changed files with 10 additions and 6 deletions

View File

@@ -1,8 +1,7 @@
package org.extism.sdk;
import org.extism.sdk.manifest.Manifest;
import com.sun.jna.Pointer;
import org.extism.sdk.manifest.Manifest;
/**
* Extism Context is used to store and manage plugins.
@@ -63,6 +62,7 @@ public class Context implements AutoCloseable {
/**
* Get the error associated with a context, if plugin is {@literal null} then the context error will be returned.
*
* @param plugin
* @return the error message
*/
@@ -72,6 +72,7 @@ public class Context implements AutoCloseable {
/**
* Return the raw pointer to this context.
*
* @return the pointer
*/
public Pointer getPointer() {

View File

@@ -11,10 +11,14 @@ import java.util.Objects;
public class Extism {
/**
* Configure the
* Configure a log file with the given {@link Path} and configure the given {@link LogLevel}.
*
* @param path
* @param level
*
* @deprecated will be replaced with better logging API.
*/
@Deprecated(forRemoval = true)
public static void setLogFile(Path path, LogLevel level) {
Objects.requireNonNull(path, "path");

View File

@@ -3,7 +3,6 @@ package org.extism.sdk;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
/**
* Wrapper around the Extism library.
@@ -14,7 +13,7 @@ public interface LibExtism extends Library {
* Holds the extism library instance.
* Resolves the extism library based on the resolution algorithm defined in {@link com.sun.jna.NativeLibrary}.
*/
LibExtism INSTANCE = Native.loadLibrary("extism", LibExtism.class);
LibExtism INSTANCE = Native.load("extism", LibExtism.class);
/**
* Create a new context
@@ -36,7 +35,7 @@ public interface LibExtism extends Library {
/**
* Sets the logger to the given path with the given level of verbosity
*
* @param path The file path of the logger
* @param path The file path of the logger
* @param logLevel The level of the logger
* @return true if successful
*/