org.apache.cayenne.event
Class EventSubject

java.lang.Object
  extended by org.apache.cayenne.event.EventSubject
All Implemented Interfaces:
Serializable

public class EventSubject
extends Object
implements Serializable

This class encapsulates the String that is used to identify the subject that a listener is interested in. Using plain Strings causes several severe problems:

See Also:
Serialized Form

Constructor Summary
protected EventSubject(String fullSubjectName)
          Protected constructor for new subjects.
 
Method Summary
 boolean equals(Object obj)
           
static EventSubject getSubject(Class<?> subjectOwner, String subjectName)
          Returns an event subject identified by the given owner and subject name.
 String getSubjectName()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventSubject

protected EventSubject(String fullSubjectName)
Protected constructor for new subjects.

Parameters:
fullSubjectName - the name of the new subject to be created
Method Detail

getSubject

public static EventSubject getSubject(Class<?> subjectOwner,
                                      String subjectName)
Returns an event subject identified by the given owner and subject name.

Parameters:
subjectOwner - the Class used for uniquely identifying this subject
subjectName - a String used as name, e.g. "MyEventTopic"
Throws:
IllegalArgumentException - if subjectOwner/subjectName are null or subjectName is empty.

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getSubjectName

public String getSubjectName()

toString

public String toString()
Overrides:
toString in class Object
Returns:
a String in the form <ClassName 0x123456> SomeName
See Also:
Object.toString()


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.