All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.khasanof.executors.matcher.SimpleDocumentsMatcher Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package org.khasanof.executors.matcher;

import org.khasanof.annotation.methods.HandleDocument;
import org.khasanof.annotation.methods.HandleDocuments;
import org.khasanof.config.ApplicationConstants;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.objects.Document;

import java.util.Arrays;
import java.util.Map;

/**
 * @author Nurislom
 * @see org.khasanof.executors.matcher
 * @since 06.07.2023 22:35
 */
@Component
public class SimpleDocumentsMatcher extends MultiGenericMatcher {

    protected SimpleDocumentsMatcher(GenericMatcher matcher) {
        super(matcher, ApplicationConstants.MATCHER_MAP);
    }

    @Override
    public boolean matcher(HandleDocuments annotation, Document value) {
        return Arrays.stream(annotation.values())
                .anyMatch(handleDocument -> matcher.matcher(handleDocument, value));
    }

    @Override
    public Class getType() {
        return HandleDocuments.class;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy