org.khasanof.executors.matcher.SimpleCallbacksMatcher 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
The newest version!
package org.khasanof.executors.matcher;
import org.khasanof.annotation.methods.HandleCallback;
import org.khasanof.annotation.methods.HandleCallbacks;
import org.khasanof.service.expression.ExpressionMatcherService;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
* @author Nurislom
* @see org.khasanof.executors.matcher
* @since 24.06.2023 0:57
*/
@Component
public class SimpleCallbacksMatcher extends GenericMatcher {
private final GenericMatcher matcher;
public SimpleCallbacksMatcher(GenericMatcher matcher, ExpressionMatcherService expressionMatcherService) {
super(expressionMatcherService);
this.matcher = matcher;
}
@Override
public boolean matcher(HandleCallbacks annotation, String value) {
return Arrays.stream(annotation.value())
.anyMatch(handleCallback -> matcher.matcher(handleCallback, value));
}
}