com.gitee.feizns.convert.method.MethodSelectionStrategyList Maven / Gradle / Ivy
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