Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.joepritzel.feather;

A subscriber that gets messages if they apply to it.

Parameters:
<T> - The type of messages to subscribe to.
Author(s):
Joe Pritzel
public abstract class PredicatedSubscriber<T> extends Subscriber<T> {

Returns true if the message applies to this subscriber. Otherwise, false.

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

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

Parameters:
o - The message.
Returns:
Returns the same as the applies method.
Throws:
SubscriberTypeMismatchException the type the subscriber was bound to is incompatible with the type that is being received.
	public boolean appliesO(Object o) {
		try {
			@SuppressWarnings("unchecked")
o2 = (T) o;
			return applies(o2);
catch (ClassCastException e) {
		}
	}
New to GrepCode? Check out our FAQ X