de.novanic.eventservice.client.event.domain
Class DefaultDomain

java.lang.Object
  extended by de.novanic.eventservice.client.event.domain.DefaultDomain
All Implemented Interfaces:
Domain, java.io.Serializable, java.lang.Comparable<Domain>

public final class DefaultDomain
extends java.lang.Object
implements Domain

Domains/contexts are used to specify the range where events should occur and listened. That supports the reuse of events (Event and listeners (RemoteEventListener.

Example:
Your application is a multiplayer online game with a conversation system. You defined the following events and listeners.

Events: NewUserEvent
Listeners: ConversationListener, ConversationChannelListener, PlayerListListener

It makes sense to divide your elements into different domains, to ensure that a NewUserEvent affects only the right context/domain. For example one conversation domain and one game domain. ConversationListener and ConversationChannelListener should be added to the conversation domain and the PlayerListListener should be added to the game domain. Now you can distinguish the context of the NewUserEvent. If a user joined a conversation (NewUserEvent added to conversation domain), the two conversation listeners will recognize it and the PlayerListListener won't be informed about the NewUserEvent in the conversation context/domain.

Author:
sstrohschein
Date: 15.08.2008
Time: 22:42:20
See Also:
Serialized Form

Constructor Summary
DefaultDomain()
          Deprecated. That constructor is only for serialization! Please use DefaultDomain(String) instead.
DefaultDomain(java.lang.String aName)
          Creates a new domain with a specified name.
 
Method Summary
 int compareTo(Domain aDomain)
           
 boolean equals(java.lang.Object anObject)
           
 java.lang.String getName()
          Return the name of the domain.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDomain

@Deprecated
public DefaultDomain()
Deprecated. That constructor is only for serialization! Please use DefaultDomain(String) instead.

See Also:
DefaultDomain(String)

DefaultDomain

public DefaultDomain(java.lang.String aName)
Creates a new domain with a specified name. The name should be unique to avoid 'collision' of events.

Parameters:
aName - unique domain name
Method Detail

getName

public java.lang.String getName()
Return the name of the domain.

Specified by:
getName in interface Domain
Returns:
domain name

compareTo

public int compareTo(Domain aDomain)
Specified by:
compareTo in interface java.lang.Comparable<Domain>

equals

public boolean equals(java.lang.Object anObject)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object