com.gitee.feizns.convert.method.AbstractDefaultMethodConverter Maven / Gradle / Ivy
package com.gitee.feizns.convert.method;
import com.gitee.feizns.convert.Converter;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
/**
* @author feizns
* @since 2019/5/28
*/
public abstract class AbstractDefaultMethodConverter implements MethodConverter {
/**
* 帮助方法装换的,其他转换器列表
*/
protected TreeSet converters;
@Override
public void setConverters(TreeSet converters) {
this.converters = converters;
}
@Override
public boolean support(Class targetType) {
return true;
}
@Override
public int priority() {
return Integer.MAX_VALUE;
}
/**
* 获取支持的转换器
* @param targetType
* @return
*/
public List getSupportConverter(Class> targetType) {
return converters.stream()
.filter(converter -> converter.support(targetType))
.collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy