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

com.gitee.feizns.convert.method.MethodSelectionStrategyList Maven / Gradle / Ivy

Go to download

Java 类型,反射,属性以及实体类操作工具类。

There is a newer version: 6.1-RELEASE
Show newest version
package com.gitee.feizns.convert.method;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author feizns
 * @since 2019/5/28
 */
public class MethodSelectionStrategyList {

    /**
     * 方法选择策略列表
     */
    private List selectionStrategiesList;

    public MethodSelectionStrategyList(MethodSelectionStrategy... strategy) {
        this.selectionStrategiesList = new ArrayList<>(Arrays.asList(strategy));
    }

    public MethodWrapper find(Class targetType, Object original, Method... methods) {
        for (MethodSelectionStrategy strategy : selectionStrategiesList) {
            MethodWrapper methodWrapper = strategy.find(targetType, original, methods);
            if ( methodWrapper != null )
                return methodWrapper;
        }
        return null;
    }

    /**
     * 添加方法选择策略
     * @param strategy
     */
    public void addMethodSelectionStrategy(MethodSelectionStrategy strategy) {
        selectionStrategiesList.add(strategy);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy