# OrtProviderOptions (onnxruntime 1.15.0 API)

Package ai.onnxruntime

## Class OrtProviderOptions

- java.lang.Object
- - ai.onnxruntime.OrtProviderOptions

All Implemented Interfaces:
  `java.lang.AutoCloseable`

Direct Known Subclasses:
  `OrtCUDAProviderOptions`, `OrtTensorRTProviderOptions`

    public abstract class OrtProviderOptions
    extends java.lang.Object
    implements java.lang.AutoCloseable

An abstract base class for execution provider options classes.

### Nested Class Summary

Nested Classes
`static interface` `OrtProviderOptions.OrtProviderSupplier` Functional interface mirroring a Java supplier, but can throw OrtException.

### Field Summary

Fields
`protected long` `nativeHandle`

### Constructor Summary

Constructors
`protected` `OrtProviderOptions​(long nativeHandle)` Constructs a OrtProviderOptions wrapped around a native pointer.

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`void` `close()`
`protected abstract void` `close​(long apiHandle, long nativeHandle)` Native close method.
`protected static long` `getApiHandle()` Allow access to the api handle pointer for subclasses.
`abstract OrtProvider` `getProvider()` Gets the provider enum for this options instance.
`protected static long` `loadLibraryAndCreate​(OrtProvider provider, OrtProviderOptions.OrtProviderSupplier createFunction)` Loads the provider's shared library (if necessary) and calls the create provider function.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### nativeHandle

    protected final long nativeHandle

### Constructor Detail

#### OrtProviderOptions

    protected OrtProviderOptions​(long nativeHandle)

Constructs a OrtProviderOptions wrapped around a native pointer.

Parameters:
  `nativeHandle` - The native pointer.

### Method Detail

#### getApiHandle

    protected static long getApiHandle()

Allow access to the api handle pointer for subclasses.

Returns:
  The api handle.

#### getProvider

    public abstract OrtProvider getProvider()

Gets the provider enum for this options instance.

Returns:
  The provider enum.

#### close

    public void close()

Specified by:
  `close` in interface `java.lang.AutoCloseable`

#### close

    protected abstract void close​(long apiHandle,
                                  long nativeHandle)

Native close method.

Parameters:
  `apiHandle` - The api pointer.
  `nativeHandle` - The native options pointer.

#### loadLibraryAndCreate

    protected static long loadLibraryAndCreate​(OrtProvider provider,
                                               OrtProviderOptions.OrtProviderSupplier createFunction)
                                        throws OrtException

Loads the provider's shared library (if necessary) and calls the create provider function.

Parameters:
  `provider` - The OrtProvider for this options.
  `createFunction` - The create function.
Returns:
  The pointer to the native provider options object.
Throws:
  `OrtException` - If either the library load or provider options create call failed.