FileDocCategorySizeDatePackage
User.javaAPI DocExample1002Mon Sep 06 17:20:50 BST 2004com.oreilly.strutsckbk.ch11.sf

User

public class User extends Object

Fields Summary
private String
username
private String
password
private String[]
roles
Constructors Summary
public User(String username)

        this.username = username;
    
public User(String username, String password)

        this.username = username;
        this.password = password;
    
public User(String username, String password, String[] roles)

        this.username = username;
        this.password = password;
        this.roles = roles;
    
Methods Summary
public java.lang.StringgetUsername()

        return username;
    
public booleanhasRole(java.lang.String role)

        for (int i=0;i<roles.length;i++) {
            if (role.equals(roles[i])) return true;
        }
        return false;
    
protected booleanmatchPassword(java.lang.String pwd)

        return password.equals(pwd);
    
public voidsetUsername(java.lang.String username)

        this.username = username;