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

io.permit.sdk.enforcement.User Maven / Gradle / Ivy

There is a newer version: 983f46e
Show newest version
package io.permit.sdk.enforcement;

import java.util.ArrayList;
import java.util.HashMap;

public class User {
    private String key;
    private String firstName = null;
    private String lastName = null;
    private String email = null;
    private ArrayList roles = null;
    private HashMap attributes = null;

    public User(Builder builder) {
        this.key = builder.key;
        this.firstName = builder.firstName;
        this.lastName = builder.lastName;
        this.email = builder.email;
        this.roles = builder.roles;
        this.attributes = builder.attributes;
    }

    public String getKey() {
        return this.key;
    }

    public String toString() {
        return this.key;
    }

    public static User fromString(String userKey) {
        return new User(new User.Builder(userKey));
    }

    public static class Builder {
        private String key;
        private String firstName = null;
        private String lastName = null;
        private String email = null;
        private ArrayList roles = null;
        private HashMap attributes = null;

        public Builder(String userKey) {
            this.key = userKey;
        }

        public Builder withFirstName(String firstName) {
            this.firstName = firstName;
            return this;
        }

        public Builder withLastName(String lastName) {
            this.lastName = lastName;
            return this;
        }

        public Builder withEmail(String email) {
            this.email = email;
            return this;
        }

        public Builder withRoles(ArrayList roles) {
            this.roles = roles;
            return this;
        }

        public Builder withAttributes(HashMap attributes) {
            this.attributes = attributes;
            return this;
        }

        public User build() {
            return new User(this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy