org.khasanof.executors.matcher.SimpleExceptionMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-fluent Show documentation
Show all versions of spring-boot-starter-fluent Show documentation
Fluent - Easy Telegram Bots with Spring
package org.khasanof.executors.matcher;
import org.khasanof.annotation.exception.HandleException;
import org.khasanof.config.ApplicationConstants;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
* @author Nurislom
* @see org.khasanof.executors.matcher
* @since 04.07.2023 22:12
*/
@Component
public class SimpleExceptionMatcher extends GenericMatcher {
public SimpleExceptionMatcher() {
super(ApplicationConstants.MATCHER_MAP);
}
@Override
public boolean matcher(HandleException annotation, Object value) {
return Arrays.stream(annotation.value())
.anyMatch(any -> any.isAssignableFrom(value.getClass()));
}
@Override
public Class getType() {
return HandleException.class;
}
}