Skip to content

Instantly share code, notes, and snippets.

@davengeo
Created April 25, 2016 16:37
Show Gist options
  • Save davengeo/6bf49e843e1b8af737e44e47ba52ba30 to your computer and use it in GitHub Desktop.
Save davengeo/6bf49e843e1b8af737e44e47ba52ba30 to your computer and use it in GitHub Desktop.
My first default method in java 8
public interface ChainOfMessageProcessors extends MessagePostProcessor {
void setNext(ChainOfMessageProcessors next);
ChainOfMessageProcessors next();
default Message toNext(Message message) throws JMSException {
if (next()!=null) {
return next().postProcessMessage(message);
}
return message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment