All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ironcorelabs.sdk.GroupCreateOpts Maven / Gradle / Ivy

There is a newer version: 0.16.0
Show newest version
// 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 GroupCreateOpts(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;
        }

        long a1 = 0;//TODO: use ptr::null() for corresponding constant
        if (name != null) {
            a1 = name.mNativeObj;
        }

        long a4 = 0;//TODO: use ptr::null() for corresponding constant
        if (owner != null) {
            a4 = owner.mNativeObj;
        }

        mNativeObj = init(a0, a1, addAsAdmin, addAsMember, a4, admins, members, needsRotation);
        JNIReachabilityFence.reachabilityFence3(id, name, owner);
    }
    private static native long init(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;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy