org.khasanof.executors.matcher.SimpleMessagesMatcher 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.methods.HandleMessage;
import org.khasanof.annotation.methods.HandleMessages;
import org.khasanof.config.ApplicationConstants;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
* @author Nurislom
* @see org.khasanof.executors.matcher
* @since 24.06.2023 1:00
*/
@Component
public class SimpleMessagesMatcher extends MultiGenericMatcher {
protected SimpleMessagesMatcher(GenericMatcher matcher) {
super(matcher, ApplicationConstants.MATCHER_MAP);
}
@Override
public boolean matcher(HandleMessages annotation, String value) {
return Arrays.stream(annotation.values())
.anyMatch(handleMessage -> matcher.matcher(handleMessage, value));
}
@Override
public Class getType() {
return HandleMessages.class;
}
}