I'm trying to pass a method as parameter. How to do it?
I have this in mind:
private static final Logger LOGGER = LoggerFactory.getLogger(MyClass.class);
@ExceptionHandler({ MyClass.class })
public ResponseEntity<BaseResponse> handleSLException(ServiceLayerException e, WebRequest request) {
checkCookie(request);
}
public void checkCookie(WebRequest request) {
String answer = request.getHeader("cookie");
if(answer!=null) {
LOGGER.error("The cookies are: " + answer);
}
How can I do the same thing using Java 8 with Lambda? I would like to be able to use the same method with more advanced technology.