本文整理汇总了Java中com.fasterxml.jackson.databind.type.TypeBindings.childInstance方法的典型用法代码示例。如果您正苦于以下问题:Java TypeBindings.childInstance方法的具体用法?Java TypeBindings.childInstance怎么用?Java TypeBindings.childInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.type.TypeBindings
的用法示例。
在下文中一共展示了TypeBindings.childInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
import com.fasterxml.jackson.databind.type.TypeBindings; //导入方法依赖的package包/类
protected JavaType getType(TypeBindings paramTypeBindings, TypeVariable<?>[] paramArrayOfTypeVariable)
{
if ((paramArrayOfTypeVariable != null) && (paramArrayOfTypeVariable.length > 0))
{
paramTypeBindings = paramTypeBindings.childInstance();
int i = paramArrayOfTypeVariable.length;
for (int j = 0; j < i; j++)
{
TypeVariable<?> localTypeVariable = paramArrayOfTypeVariable[j];
paramTypeBindings._addPlaceholder(localTypeVariable.getName());
Type localType = localTypeVariable.getBounds()[0];
JavaType localJavaType;
if (localType == null)
localJavaType = TypeFactory.unknownType();
else
localJavaType = paramTypeBindings.resolveType(localType);
paramTypeBindings.addBinding(localTypeVariable.getName(), localJavaType);
}
}
return paramTypeBindings.resolveType(getGenericType());
}
示例2: getType
import com.fasterxml.jackson.databind.type.TypeBindings; //导入方法依赖的package包/类
protected JavaType getType(TypeBindings bindings, TypeVariable<?>[] typeParams)
{
// [JACKSON-468] Need to consider local type binding declarations too...
if (typeParams != null && typeParams.length > 0) {
bindings = bindings.childInstance();
for (TypeVariable<?> var : typeParams) {
String name = var.getName();
// to prevent infinite loops, need to first add placeholder ("<T extends Enum<T>>" etc)
bindings._addPlaceholder(name);
// About only useful piece of information is the lower bound (which is at least Object.class)
Type lowerBound = var.getBounds()[0];
JavaType type = (lowerBound == null) ? TypeFactory.unknownType()
: bindings.resolveType(lowerBound);
bindings.addBinding(var.getName(), type);
}
}
return bindings.resolveType(getGenericType());
}