com.ironcorelabs.sdk.IronOxideConfig Maven / Gradle / Ivy
// Automatically generated by rust_swig
package com.ironcorelabs.sdk;
/**
* Top-level configuration object for IronOxide
*/
public final class IronOxideConfig {
public IronOxideConfig() {
mNativeObj = init();
}
private static native long init();
/**
* @param policyCaching policy caching configuration for IronOxide
* @param sdkOperationTimeout timeout for all SDK methods
*/
public IronOxideConfig(PolicyCachingConfig policyCaching, Duration sdkOperationTimeout) {
long a0 = policyCaching.mNativeObj;
long a1 = 0;//TODO: use ptr::null() for corresponding constant
if (sdkOperationTimeout != null) {
a1 = sdkOperationTimeout.mNativeObj;
}
mNativeObj = init(a0, a1);
JNIReachabilityFence.reachabilityFence2(policyCaching, sdkOperationTimeout);
}
private static native long init(long policyCaching, long sdkOperationTimeout);
public final PolicyCachingConfig getPolicyCachingConfig() {
long ret = do_getPolicyCachingConfig(mNativeObj);
PolicyCachingConfig convRet = new PolicyCachingConfig(InternalPointerMarker.RAW_PTR, ret);
return convRet;
}
private static native long do_getPolicyCachingConfig(long self);
public final java.util.Optional getSdkOperationTimeout() {
long ret = do_getSdkOperationTimeout(mNativeObj);
java.util.Optional convRet;
if (ret != 0) {
convRet = java.util.Optional.of(new Duration(InternalPointerMarker.RAW_PTR, ret));
} else {
convRet = java.util.Optional.empty();
}
return convRet;
}
private static native long do_getSdkOperationTimeout(long self);
public synchronized void delete() {
if (mNativeObj != 0) {
do_delete(mNativeObj);
mNativeObj = 0;
}
}
@Override
protected void finalize() throws Throwable {
try {
delete();
}
finally {
super.finalize();
}
}
private static native void do_delete(long me);
/*package*/ IronOxideConfig(InternalPointerMarker marker, long ptr) {
assert marker == InternalPointerMarker.RAW_PTR;
this.mNativeObj = ptr;
}
/*package*/ long mNativeObj;
}