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

org.khasanof.executors.invoker.DefaultInvokerMatcher Maven / Gradle / Ivy

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

import org.khasanof.annotation.methods.HandleMessage;
import org.khasanof.enums.MatchScope;
import org.khasanof.model.InvokerMethod;
import org.springframework.stereotype.Component;

import java.lang.annotation.Annotation;
import java.util.Arrays;

/**
 * @author Nurislom
 * @see org.khasanof.executors.invoker
 * @since 8/11/2023 10:00 PM
 */
@Component(value = DefaultInvokerMatcher.NAME)
public class DefaultInvokerMatcher {

    public static final String NAME = "defaultInvokerMatcher";

    public boolean messageScopeEq(InvokerMethod method) {
        Annotation[] annotations = method.getMethod().getDeclaredAnnotations();
        return Arrays.stream(annotations).anyMatch(annotation -> {
            if (annotation.annotationType().equals(HandleMessage.class)) {
                HandleMessage handleMessage = (HandleMessage) annotation;
                return handleMessage.scope().equals(MatchScope.VAR_EXPRESSION);
            }
            return false;
        });
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy