com.ironcorelabs.sdk.PolicyGrant Maven / Gradle / Ivy
// Automatically generated by rust_swig
package com.ironcorelabs.sdk;
public final class PolicyGrant {
public PolicyGrant() {
mNativeObj = init();
}
private static native long init();
public PolicyGrant(Category category, Sensitivity sensitivity, DataSubject dataSubject, UserId substituteUser) {
long a0 = 0;//TODO: use ptr::null() for corresponding constant
if (category != null) {
a0 = category.mNativeObj;
}
long a1 = 0;//TODO: use ptr::null() for corresponding constant
if (sensitivity != null) {
a1 = sensitivity.mNativeObj;
}
long a2 = 0;//TODO: use ptr::null() for corresponding constant
if (dataSubject != null) {
a2 = dataSubject.mNativeObj;
}
long a3 = 0;//TODO: use ptr::null() for corresponding constant
if (substituteUser != null) {
a3 = substituteUser.mNativeObj;
}
mNativeObj = init(a0, a1, a2, a3);
JNIReachabilityFence.reachabilityFence4(category, sensitivity, dataSubject, substituteUser);
}
private static native long init(long category, long sensitivity, long dataSubject, long substituteUser);
public final java.util.Optional category() {
long ret = do_category(mNativeObj);
java.util.Optional convRet;
if (ret != 0) {
convRet = java.util.Optional.of(new Category(InternalPointerMarker.RAW_PTR, ret));
} else {
convRet = java.util.Optional.empty();
}
return convRet;
}
private static native long do_category(long self);
public final java.util.Optional sensitivity() {
long ret = do_sensitivity(mNativeObj);
java.util.Optional convRet;
if (ret != 0) {
convRet = java.util.Optional.of(new Sensitivity(InternalPointerMarker.RAW_PTR, ret));
} else {
convRet = java.util.Optional.empty();
}
return convRet;
}
private static native long do_sensitivity(long self);
public final java.util.Optional dataSubject() {
long ret = do_dataSubject(mNativeObj);
java.util.Optional convRet;
if (ret != 0) {
convRet = java.util.Optional.of(new DataSubject(InternalPointerMarker.RAW_PTR, ret));
} else {
convRet = java.util.Optional.empty();
}
return convRet;
}
private static native long do_dataSubject(long self);
public final java.util.Optional substituteId() {
long ret = do_substituteId(mNativeObj);
java.util.Optional convRet;
if (ret != 0) {
convRet = java.util.Optional.of(new UserId(InternalPointerMarker.RAW_PTR, ret));
} else {
convRet = java.util.Optional.empty();
}
return convRet;
}
private static native long do_substituteId(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*/ PolicyGrant(InternalPointerMarker marker, long ptr) {
assert marker == InternalPointerMarker.RAW_PTR;
this.mNativeObj = ptr;
}
/*package*/ long mNativeObj;
}