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

com.github.linyuzai.plugin.autoconfigure.bean.BeanExtractor Maven / Gradle / Ivy

The newest version!
package com.github.linyuzai.plugin.autoconfigure.bean;

import com.github.linyuzai.plugin.core.context.PluginContext;
import com.github.linyuzai.plugin.core.handle.extract.AbstractPluginExtractor;
import com.github.linyuzai.plugin.core.handle.extract.convert.PluginConvertor;
import com.github.linyuzai.plugin.core.handle.extract.match.PluginMatcher;
import com.github.linyuzai.plugin.core.type.NestedType;

import java.lang.annotation.Annotation;

/**
 * Bean 提取器
 */
public abstract class BeanExtractor extends AbstractPluginExtractor {

    @Override
    public PluginMatcher getMatcher(NestedType type, Annotation[] annotations) {
        return new BeanMatcher(type.toClass(), annotations);
    }

    @Override
    public PluginConvertor getConvertor(NestedType type, Annotation[] annotations) {
        return new BeanConvertor();
    }

    /**
     * Bean 插件提取执行器工厂
     */
    public static class InvokerFactory extends AbstractPluginExtractor.InvokerFactory {

        @Override
        protected AbstractPluginExtractor createExtractor() {
            return new BeanExtractor() {
                @Override
                public void onExtract(Object plugin, PluginContext context) {
                }
            };
        }
    }
}