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 getCategory() {
long ret = do_getCategory(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_getCategory(long self);
public final java.util.Optional getSensitivity() {
long ret = do_getSensitivity(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_getSensitivity(long self);
public final java.util.Optional getDataSubject() {
long ret = do_getDataSubject(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_getDataSubject(long self);
public final java.util.Optional getSubstituteId() {
long ret = do_getSubstituteId(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_getSubstituteId(long self);
public final int hashCode() {
int ret = do_hashCode(mNativeObj);
return ret;
}
private static native int do_hashCode(long self);
private final boolean rustEq(PolicyGrant o) {
long a0 = o.mNativeObj;
boolean ret = do_rustEq(mNativeObj, a0);
JNIReachabilityFence.reachabilityFence1(o);
return ret;
}
private static native boolean do_rustEq(long self, long o);
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;
public boolean equals(Object obj) {
if(obj instanceof PolicyGrant){
PolicyGrant other = (PolicyGrant) obj;
return other.rustEq(this);
}
return false;
}
}