org.khasanof.executors.matcher.SimpleCallbackMatcher 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.service.expression.ExpressionMatcherService;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
* Author: Nurislom
*
* Date: 20.06.2023
*
* Time: 21:55
*
* Package: org.khasanof.core.executors.matcher
*/
@Component
public class SimpleCallbackMatcher extends GenericMatcher {
public SimpleCallbackMatcher(ExpressionMatcherService expressionMatcherService) {
super(expressionMatcherService);
}
@Override
public boolean matcher(HandleCallback handleCallback, String value) {
return Arrays.stream(handleCallback.value())
.anyMatch(annValue -> expressionMatcherService.match(handleCallback.match(), annValue, value));
}
}