package com.knutejohnson.pi.chat;

import java.net.*;

public class User {
    private String handle;
    private String password;
    private InetAddress address;

    public User(String handle, String password, InetAddress address) {
        this.handle = handle;
        this.password = password;
        this.address = address;
    }

    public synchronized String getHandle() {
        return handle;
    }

    public synchronized String getPassword() {
        return password;
    }

    public synchronized InetAddress getAddress() {
        return address;
    }

    public synchronized User setHandle(String handle) {
        this.handle = handle;

        return this;
    }

    public synchronized User setPassword(String password) {
        this.password = password;

        return this;
    }

    public synchronized User setAddress(InetAddress address) {
        this.address = address;

        return this;
    }

    public String toString() {
        return String.format("%s/%s",getHandle(),
         getAddress() == null ? "" : getAddress().getHostAddress());
    }
}