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

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

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

import org.khasanof.annotation.exception.HandleException;
import org.khasanof.config.ApplicationConstants;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author Nurislom
 * @see org.khasanof.executors.matcher
 * @since 04.07.2023 22:12
 */
@Component
public class SimpleExceptionMatcher extends GenericMatcher {

    public SimpleExceptionMatcher() {
        super(ApplicationConstants.MATCHER_MAP);
    }

    @Override
    public boolean matcher(HandleException annotation, Object value) {
        return Arrays.stream(annotation.value())
                .anyMatch(any -> any.isAssignableFrom(value.getClass()));
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy