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

org.khasanof.collector.SimpleCollector Maven / Gradle / Ivy

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

import org.khasanof.GenericContains;
import org.khasanof.collector.questMethod.SearchMethod;
import org.khasanof.enums.HandleClasses;
import org.khasanof.enums.HandleType;
import org.khasanof.model.InvokerResult;
import org.springframework.stereotype.Component;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Set;

/**
 * @author Nurislom
 * @see org.khasanof.collector
 * @since 8/19/2023 12:22 PM
 */
@SuppressWarnings("unchecked")
@Component(SimpleCollector.NAME)
public class SimpleCollector extends AbstractCollector implements Collector> {

    public static final String NAME = "simpleCollector";

    public SimpleCollector(SearchMethod questMethod, GenericContains genericContains, AnnotationMethodContext> annotationContext) {
        super(questMethod, annotationContext);
    }

    @Override
    public InvokerResult getInvokerResult(Object value, Class annotation) {
        return questMethod.getMethodValueAnn(value, HandleClasses.getHandleWithType(annotation));
    }

    @Override
    public InvokerResult getHandleAnyMethod(HandleType handleType) {
        return questMethod.getHandleAnyMethod(handleType);
    }

    @Override
    public Set getAllHandleAnyMethod(HandleType handleType) {
        return questMethod.getAllHandleAnyMethod(handleType);
    }

    @Override
    public boolean hasHandle(Class annotation) {
        return annotationContext.containsKey(annotation);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy