- All Implemented Interfaces:
public class EventSubject extends Object implements SerializableThis class encapsulates the String that is used to identify the subject that a listener is interested in. Using plain Strings causes several severe problems:
- it's easy to misspell a subject, leading to undesired behaviour at runtime that is hard to debug.
- in systems with many different subjects there is no safeguard for defining the same subject twice for different purposes. This is especially true in a distributed setting.
- See Also:
- Serialized Form
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
getSubject(Class<?> subjectOwner, String subjectName)Returns an event subject identified by the given owner and subject name.
protected EventSubject(String fullSubjectName)Protected constructor for new subjects.
fullSubjectName- the name of the new subject to be created
public static EventSubject getSubject(Class<?> subjectOwner, String subjectName)Returns an event subject identified by the given owner and subject name.
subjectOwner- the Class used for uniquely identifying this subject
subjectName- a String used as name, e.g. "MyEventTopic"
IllegalArgumentException- if subjectOwner/subjectName are
nullor subjectName is empty.
public String getSubjectName()