br.com.arsmachina.authentication.entity
Class Permission

java.lang.Object
  extended by br.com.arsmachina.authentication.entity.Permission
All Implemented Interfaces:
Serializable, Comparable<Permission>

public final class Permission
extends Object
implements Comparable<Permission>, Serializable

Class that represents a single permission.

Author:
Thiago H. de Paula Figueiredo
See Also:
Serialized Form

Field Summary
static int MAXIMUM_NAME_LENGTH
          Maximum name length.
static int MINIMUM_NAME_LENGTH
          Minimum name length.
static String USER_ROLE_NAME
          Name of the role that all users have.
 
Constructor Summary
Permission()
          No-arg constructor.
Permission(String name)
          Constructor that receives a name.
 
Method Summary
 int compareTo(Permission o)
           
 boolean equals(Object obj)
           
 Integer getId()
          Returns the value of the id property.
 String getName()
          Returns the value of the name property.
 int hashCode()
           
 void setId(Integer id)
          Changes the value of the id property.
 void setName(String name)
          Changes the value of the name property.
 String toString()
          Returns the name property.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

USER_ROLE_NAME

public static final String USER_ROLE_NAME
Name of the role that all users have.

See Also:
Constant Field Values

MINIMUM_NAME_LENGTH

public static final int MINIMUM_NAME_LENGTH
Minimum name length.

See Also:
Constant Field Values

MAXIMUM_NAME_LENGTH

public static final int MAXIMUM_NAME_LENGTH
Maximum name length.

See Also:
Constant Field Values
Constructor Detail

Permission

public Permission()
No-arg constructor.


Permission

public Permission(String name)
Constructor that receives a name.

Parameters:
name - a String. It cannot be null.
Throws:
IllegalArgumentException - if name is null.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

compareTo

public int compareTo(Permission o)
Specified by:
compareTo in interface Comparable<Permission>
See Also:
Comparable.compareTo(java.lang.Object)

toString

public String toString()
Returns the name property.

Overrides:
toString in class Object
Returns:
a String.

getId

public Integer getId()
Returns the value of the id property.

Returns:
a Integer.

setId

public void setId(Integer id)
Changes the value of the id property.

Parameters:
id - a Integer.

getName

@NotNull
@Length(min=2,
        max=50)
public String getName()
Returns the value of the name property.

Returns:
a String.

setName

public void setName(String name)
Changes the value of the name property.

Parameters:
name - a String.


Copyright © 2008-2009 Thiago H. de Paula Figueiredo. All Rights Reserved.