Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.joepritzel.feather;

Parameters:
<T> - The type of message to listen for.
Author(s):
Joe Pritzel
 
public abstract class Subscriber<T> {

The method that will be invoked when the subscriber receives a message.

Parameters:
message - The message.
Throws:
SubscriberTypeMismatchException the type the subscriber was bound to is incompatible with the type that is being received.
	public abstract void receive(T message);

A method that casts the message and calls the method that uses generics.
Do not overide.

Parameters:
o - The message that will be received by the subscriber.
Throws:
SubscriberTypeMismatchException the type the subscriber was bound to is incompatible with the type that is being received.
	public void receiveO(Object o) {
		try {
			@SuppressWarnings("unchecked")
o2 = (T) o;
			receive(o2);
catch (ClassCastException e) {
		}
	}
New to GrepCode? Check out our FAQ X