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

com.happy3w.toolkits.manager.AnnotationDetector Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.happy3w.toolkits.manager;

import java.lang.annotation.Annotation;
import java.util.function.Function;

public class AnnotationDetector implements IConfigDetector {
    private final Class annType;
    private final Function configGenerator;

    public AnnotationDetector(Class annType, Function configGenerator) {
        this.annType = annType;
        this.configGenerator = configGenerator;
    }

    @Override
    public CT detectConfig(Class dataType) {
        AT ann = dataType.getDeclaredAnnotation(annType);
        if (ann == null) {
            return null;
        }
        return configGenerator.apply(ann);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy