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

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

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

import org.khasanof.annotation.methods.HandleAudio;
import org.khasanof.annotation.methods.HandleAudios;
import org.khasanof.config.ApplicationConstants;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.objects.Audio;

import java.util.Arrays;

/**
 * @author Nurislom
 * @see org.khasanof.executors.matcher
 * @since 09.07.2023 16:08
 */
@Component
public class SimpleAudiosMatcher extends MultiGenericMatcher {

    public SimpleAudiosMatcher(SimpleAudioMatcher matcher) {
        super(matcher, ApplicationConstants.MATCHER_MAP);
    }

    @Override
    public boolean matcher(HandleAudios annotation, Audio value) {
        return multiMatchScopeFunctionMap.get(annotation.match())
                .apply(Arrays.stream(annotation.values()),
                        (handleAudio -> matcher.matcher(handleAudio, value)));
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy