Homepage

org.talos.model
Class Subject

java.lang.Object
  extended by org.talos.model.Subject
All Implemented Interfaces:
Comparable<Subject>, NamedObject

public class Subject
extends Object
implements NamedObject, Comparable<Subject>

This class represents a Subject. A Subject is an entity that can be granted permissions on secure objects and categories. It is identified by its name, so you can't have two subjects with the same name in a system. The proper way to work with subjects is through the SubjectContainer.

See Also:
SubjectContainer

Constructor Summary
protected Subject()
          Empty constructor used by Hibernate.
  Subject(String name)
          Public constructor that receives a name.
 
Method Summary
 int compareTo(Subject subject)
          This comparator uses the attribute name, to compare strings, this method uses compareToIgnoreCase
 boolean equals(Object obj)
           
 String getName()
          Gets the name of the object
 int hashCode()
           
protected  void setName(String name)
          Sets the name of the subject.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Subject

protected Subject()
Empty constructor used by Hibernate.


Subject

public Subject(String name)
Public constructor that receives a name. The name must be not null.

Parameters:
name - the name for the subject
Method Detail

getName

public String getName()
Description copied from interface: NamedObject
Gets the name of the object

Specified by:
getName in interface NamedObject
Returns:
the name of the object

setName

protected void setName(String name)
Sets the name of the subject.

Parameters:
name - the name of the subject

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Subject subject)
This comparator uses the attribute name, to compare strings, this method uses compareToIgnoreCase

Specified by:
compareTo in interface Comparable<Subject>
Parameters:
subject - subject to compare
Returns:
1 if subject is null or if this.name is greater than subject.getName() 0 if this.name == null and subject.getName() == null or if both strings are equals -1 if subject.getName() is greater than this.name

Homepage