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

net.intelie.live.plugins.messenger.connections.UserConnection Maven / Gradle / Ivy

The newest version!
package net.intelie.live.plugins.messenger.connections;

import net.intelie.live.plugins.messenger.data.UserData;

import java.util.Objects;

public class UserConnection {
    private final boolean isSuperUser;
    private final UserData user;
    private final String host;

    public UserConnection(String host, UserData user, boolean isSuperUser) {
        this.user = user;
        this.host = host;
        this.isSuperUser = isSuperUser;
    }

    public Integer getUserId() {
        return user == null ? null : user.getId();
    }

    public String getUserName() {
        return user == null ? null : user.getName();
    }

    public boolean isSuperUser() {
        return this.isSuperUser;
    }

    public UserData userData() {
        return this.user;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof UserConnection)) return false;
        UserConnection that = (UserConnection) o;

        return Objects.equals(this.user, that.user)
                && Objects.equals(this.host, that.host);
    }

    @Override
    public int hashCode() {
        return Objects.hash(user, host);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy