SelectiveHandler

public interface SelectiveHandler<T, C extends MessageClass<?>, E extends MessageEnvelope<? extends Object, ? extends Object, ? extends Object>, R extends MessageClass<?>> implements HandlerMethod<T, C, E, R>

A handler method which accept only instances of messages that match the filtering conditions.

Having two or more methods that accept the same message type but instances of different values to avoid if-elif branches (that filter by the value of the message in a bigger method).

It is possible to filter by the same field of the same message type.

See also

io.spine.core.ByField

Inheritors

Functions

Link copied to clipboard
public abstract ArgumentFilter filter()
Obtains the filter to apply to the messages received by this method.

Inherited functions

Link copied to clipboard
public abstract Set<Attribute<? extends Object>> attributes()
Obtains the set of method attributes configured for this method.
Link copied to clipboard
public abstract void discoverAttributes()
Link copied to clipboard
public void ensureExternalMatch(boolean expectedValue)
Ensures that the external attribute of the method is the one expected.
Link copied to clipboard
public abstract DispatchOutcome invoke(T target, E envelope)
Invokes the method to handle message with the context.
Link copied to clipboard
public boolean isDomestic()
Tells if the passed method is domestic, that is not marked as external).
Link copied to clipboard
public boolean isExternal()
Tells if the passed method is external.
Link copied to clipboard
public DispatchKey key()
Creates a handler method dispatch key out of the message class.
Link copied to clipboard
public abstract C messageClass()
Obtains the type of the incoming message class.
Link copied to clipboard
public abstract MethodParams params()
Obtains parameters of the method.
Link copied to clipboard
public abstract Set<R> producedMessages()
Retrieves the message classes produced by this handler method.
Link copied to clipboard
public abstract Method rawMethod()
Obtains the handling method.
Link copied to clipboard
public abstract Success toSuccessfulOutcome(Object rawResult, T target, E handledSignal)
Converts the raw method result to a successful propagation outcome.