com.ironcorelabs.sdk.GroupCreateOpts Maven / Gradle / Ivy
// Automatically generated by rust_swig
package com.ironcorelabs.sdk;
/**
* Options for group creation.
*/
public final class GroupCreateOpts {
public GroupCreateOpts() {
mNativeObj = init();
}
private static native long init();
/**
* @param id unique id of a group within a segment. If null, the server will assign an id.
* @param name human readable name of the group. Does not need to be unique.
* @param addAsAdmin if true (default), the creating user will be added as a group admin.
* @param addAsMember if true (default), the creating user will be added to the group's membership.
* @param owner if null (default), the creating user will be the owner of the group, else the specified user will be the owner and automatically added as an admin.
* @param admins list of users to be added as admins of the group. This list takes priority over `addAsAdmin`, so the creating user will be added as an admin even if `addAsAdmin` is false.
* @param members list of users to be added as members of the group. This list takes priority over `addAsMember`, so the creating user will be added as a member even if `addAsMember` is false.
* @param needsRotation if true, the group will be marked as needing its private key rotated.
*/
public static GroupCreateOpts create(GroupId id, GroupName name, boolean addAsAdmin, boolean addAsMember, UserId owner, UserId [] admins, UserId [] members, boolean needsRotation) {
long a0 = 0;//TODO: use ptr::null() for corresponding constant
if (id != null) {
a0 = id.mNativeObj;
id.mNativeObj = 0;
}
long a1 = 0;//TODO: use ptr::null() for corresponding constant
if (name != null) {
a1 = name.mNativeObj;
name.mNativeObj = 0;
}
long a4 = 0;//TODO: use ptr::null() for corresponding constant
if (owner != null) {
a4 = owner.mNativeObj;
owner.mNativeObj = 0;
}
long ret = do_create(a0, a1, addAsAdmin, addAsMember, a4, admins, members, needsRotation);
GroupCreateOpts convRet = new GroupCreateOpts(InternalPointerMarker.RAW_PTR, ret);
JNIReachabilityFence.reachabilityFence3(id, name, owner);
return convRet;
}
private static native long do_create(long id, long name, boolean addAsAdmin, boolean addAsMember, long owner, UserId [] admins, UserId [] members, boolean needsRotation);
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*/ GroupCreateOpts(InternalPointerMarker marker, long ptr) {
assert marker == InternalPointerMarker.RAW_PTR;
this.mNativeObj = ptr;
}
/*package*/ long mNativeObj;
}