本文整理汇总了Java中com.atomicleopard.expressive.collection.Pair类的典型用法代码示例。如果您正苦于以下问题:Java Pair类的具体用法?Java Pair怎么用?Java Pair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Pair类属于com.atomicleopard.expressive.collection包,在下文中一共展示了Pair类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBestTransformer
import com.atomicleopard.expressive.collection.Pair; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <From, To> ETransformer<? super From, ? extends To> getBestTransformer(Class<From> fromType, Class<To> toType) {
if (TypeIntrospector.isABasicType(fromType)) {
fromType = (Class<From>) TypeIntrospector.box(fromType);
}
if (TypeIntrospector.isABasicType(toType)) {
toType = (Class<To>) TypeIntrospector.box(toType);
}
ETransformer<? super From, ? extends To> transformer = getTransformer(fromType, toType);
if (transformer != null) {
return transformer;
}
transformer = getFromCache(fromType, toType);
if (transformer != null) {
return transformer;
}
List<Class<?>> fromTypes = classIntrospector.listImplementedTypes(fromType);
for (Class<?> f : fromTypes) {
for (Pair<Class<?>, Class<?>> entry : transformers.keySet()) {
Class<?> t = entry.getB();
if (toType.isAssignableFrom(t)) {
transformer = (ETransformer<? super From, ? extends To>) getTransformer(f, t);
if (transformer != null) {
addToCache(fromType, toType, transformer);
return transformer;
}
}
}
}
return null;
}