当前位置: 首页>>代码示例>>Java>>正文


Java TypeBindings类代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.type.TypeBindings的典型用法代码示例。如果您正苦于以下问题:Java TypeBindings类的具体用法?Java TypeBindings怎么用?Java TypeBindings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeBindings类属于com.fasterxml.jackson.databind.type包,在下文中一共展示了TypeBindings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyModifiers

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
private JavaType applyModifiers(JavaType resultType, Class<?> sourceType) throws IllegalStateException {
    if (modifiers != null) {
        TypeBindings b = resultType.getBindings();
        if (b == null) {
            b = TypeBindings.emptyBindings();
        }
        for (TypeModifier mod : modifiers) {
            JavaType t = mod.modifyType(resultType, sourceType, b, mapper.getTypeFactory());
            if (t == null) {
                throw new IllegalStateException(String.format(
                        "TypeModifier %s (of type %s) return null for type %s",
                        mod, mod.getClass().getName(), resultType));
            }
            resultType = t;
        }
    }
    return resultType;
}
 
开发者ID:optionfactory,项目名称:hibernate-json,代码行数:19,代码来源:JacksonJsonDriver.java

示例2: _constructWriter

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
protected BeanPropertyWriter _constructWriter(SerializerProvider paramSerializerProvider, BeanPropertyDefinition paramBeanPropertyDefinition, TypeBindings paramTypeBindings, PropertyBuilder paramPropertyBuilder, boolean paramBoolean, AnnotatedMember paramAnnotatedMember)
{
  String str = paramBeanPropertyDefinition.getName();
  if (paramSerializerProvider.canOverrideAccessModifiers())
    paramAnnotatedMember.fixAccess();
  JavaType localJavaType = paramAnnotatedMember.getType(paramTypeBindings);
  BeanProperty.Std localStd = new BeanProperty.Std(str, localJavaType, paramBeanPropertyDefinition.getWrapperName(), paramPropertyBuilder.getClassAnnotations(), paramAnnotatedMember, paramBeanPropertyDefinition.isRequired());
  JsonSerializer localJsonSerializer1 = findSerializerFromAnnotation(paramSerializerProvider, paramAnnotatedMember);
  JsonSerializer localJsonSerializer2 = localJsonSerializer1;
  if ((localJsonSerializer1 instanceof ResolvableSerializer))
    ((ResolvableSerializer)localJsonSerializer2).resolve(paramSerializerProvider);
  if ((localJsonSerializer2 instanceof ContextualSerializer))
    localJsonSerializer2 = ((ContextualSerializer)localJsonSerializer2).createContextual(paramSerializerProvider, localStd);
  boolean bool = ClassUtil.isCollectionMapOrArray(localJavaType.getRawClass());
  TypeSerializer localTypeSerializer1 = null;
  if (bool)
    localTypeSerializer1 = findPropertyContentTypeSerializer(localJavaType, paramSerializerProvider.getConfig(), paramAnnotatedMember);
  TypeSerializer localTypeSerializer2 = findPropertyTypeSerializer(localJavaType, paramSerializerProvider.getConfig(), paramAnnotatedMember);
  return paramPropertyBuilder.buildWriter(paramBeanPropertyDefinition, localJavaType, localJsonSerializer2, localTypeSerializer2, localTypeSerializer1, paramAnnotatedMember, paramBoolean);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:BeanSerializerFactory.java

示例3: 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());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:22,代码来源:AnnotatedWithParams.java

示例4: 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());
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:19,代码来源:AnnotatedWithParams.java

示例5: constructJavaType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
private JavaType constructJavaType(final Type type) {
    if (type instanceof ParameterizedType) {
        JavaType[] javaTypeArgs = new JavaType[((ParameterizedType) type).getActualTypeArguments().length];
        for (int i = 0; i != ((ParameterizedType) type).getActualTypeArguments().length; ++i) {
            javaTypeArgs[i] = constructJavaType(((ParameterizedType) type).getActualTypeArguments()[i]);
        }
        return mapper.getTypeFactory().constructType(type,
            TypeBindings.create((Class<?>) ((ParameterizedType) type).getRawType(), javaTypeArgs));
    } else {
        return mapper.getTypeFactory().constructType(type);
    }
}
 
开发者ID:Azure,项目名称:autorest-clientruntime-for-java,代码行数:13,代码来源:JacksonAdapter.java

示例6: resolve

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
private JavaType resolve(final JavaType type) {
    Assert.notNull(type, "type can't be null");
    JavaType tmp = type;
    while(Keeper.class.equals(tmp.getRawClass())) {
        TypeBindings bindings = tmp.getBindings();
        Assert.isTrue(bindings.size() == 1, "Bindings must have one parameter type: " + type);
        tmp = bindings.getBoundType(0);
    }
    return tmp;
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:11,代码来源:KeeperDeserializer.java

示例7: modifyType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
@Override
public JavaType modifyType(JavaType type, Type jdkType, TypeBindings context, TypeFactory typeFactory) {
    try {
        if (type.getClass().isAssignableFrom(SimpleType.class)) {
            Object overriddenBean = applicationContext.getBean(type.getRawClass().getName());
            return SimpleType.construct(overriddenBean.getClass());
        }
    } catch (NoSuchBeanDefinitionException e) {
        LOG.debug("No configured bean for " + type.getClass().getName() + " returning original type");
    }
    return type;
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:13,代码来源:WrapperOverrideTypeModifier.java

示例8: findBeanProperties

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
protected List<BeanPropertyWriter> findBeanProperties(SerializerProvider paramSerializerProvider, BeanDescription paramBeanDescription, BeanSerializerBuilder paramBeanSerializerBuilder)
{
  List localList = paramBeanDescription.findProperties();
  SerializationConfig localSerializationConfig = paramSerializerProvider.getConfig();
  removeIgnorableTypes(localSerializationConfig, paramBeanDescription, localList);
  if (localSerializationConfig.isEnabled(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS))
    removeSetterlessGetters(localSerializationConfig, paramBeanDescription, localList);
  if (localList.isEmpty())
    return null;
  boolean bool = usesStaticTyping(localSerializationConfig, paramBeanDescription, null);
  PropertyBuilder localPropertyBuilder = constructPropertyBuilder(localSerializationConfig, paramBeanDescription);
  ArrayList localArrayList = new ArrayList(localList.size());
  TypeBindings localTypeBindings = paramBeanDescription.bindingsForBeanType();
  Iterator localIterator = localList.iterator();
  while (localIterator.hasNext())
  {
    BeanPropertyDefinition localBeanPropertyDefinition = (BeanPropertyDefinition)localIterator.next();
    AnnotatedMember localAnnotatedMember = localBeanPropertyDefinition.getAccessor();
    if (localBeanPropertyDefinition.isTypeId())
    {
      if (localAnnotatedMember != null)
      {
        if (localSerializationConfig.canOverrideAccessModifiers())
          localAnnotatedMember.fixAccess();
        paramBeanSerializerBuilder.setTypeId(localAnnotatedMember);
      }
    }
    else
    {
      AnnotationIntrospector.ReferenceProperty localReferenceProperty = localBeanPropertyDefinition.findReferenceType();
      if ((localReferenceProperty == null) || (!localReferenceProperty.isBackReference()))
        if ((localAnnotatedMember instanceof AnnotatedMethod))
          localArrayList.add(_constructWriter(paramSerializerProvider, localBeanPropertyDefinition, localTypeBindings, localPropertyBuilder, bool, (AnnotatedMethod)localAnnotatedMember));
        else
          localArrayList.add(_constructWriter(paramSerializerProvider, localBeanPropertyDefinition, localTypeBindings, localPropertyBuilder, bool, (AnnotatedField)localAnnotatedMember));
    }
  }
  return localArrayList;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:40,代码来源:BeanSerializerFactory.java

示例9: constructValueInstantiator

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
public ValueInstantiator constructValueInstantiator(DeserializationConfig config)
{
    StdValueInstantiator inst = new StdValueInstantiator(config, _beanDesc.getType());

    JavaType delegateType;

    if (_delegateCreator == null) {
        delegateType = null;
    } else {
        // need to find type...
        int ix = 0;
        if (_delegateArgs != null) {
            for (int i = 0, len = _delegateArgs.length; i < len; ++i) {
                if (_delegateArgs[i] == null) { // marker for delegate itself
                    ix = i;
                    break;
                }
            }
        }
        TypeBindings bindings = _beanDesc.bindingsForBeanType();
        delegateType = bindings.resolveType(_delegateCreator.getGenericParameterType(ix));
    }
    
    inst.configureFromObjectSettings(_defaultConstructor,
            _delegateCreator, delegateType, _delegateArgs,
            _propertyBasedCreator, _propertyBasedArgs);
    inst.configureFromStringCreator(_stringCreator);
    inst.configureFromIntCreator(_intCreator);
    inst.configureFromLongCreator(_longCreator);
    inst.configureFromDoubleCreator(_doubleCreator);
    inst.configureFromBooleanCreator(_booleanCreator);
    return inst;
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:34,代码来源:CreatorCollector.java

示例10: getTSTypeForClass

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
private AbstractType getTSTypeForClass(AnnotatedMember member) {

		TypeBindings bindings = new TypeBindings(TypeFactory.defaultInstance(), member.getDeclaringClass());
		BeanProperty prop = new BeanProperty.Std(member.getName(), member.getType(bindings), NO_NAME,
				new AnnotationMap(), member, false);

		try {
			return getTSTypeForProperty(prop);
		} catch (JsonMappingException e) {
			throw new RuntimeException(e);
		}
	}
 
开发者ID:raphaeljolivet,项目名称:java2typescript,代码行数:13,代码来源:TSJsonObjectFormatVisitor.java

示例11: modifyType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
@Override
public JavaType modifyType(JavaType type, Type jdkType, TypeBindings context, TypeFactory typeFactory) {
    called = true;
    return type;
}
 
开发者ID:optionfactory,项目名称:hibernate-json,代码行数:6,代码来源:JacksonJsonDriverTest.java

示例12: bindingsForBeanType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
public TypeBindings bindingsForBeanType()
{
  if (this._bindings == null)
    this._bindings = new TypeBindings(this._config.getTypeFactory(), this._type);
  return this._bindings;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:7,代码来源:BasicBeanDescription.java

示例13: getType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
public final JavaType getType(TypeBindings paramTypeBindings)
{
  return getType(paramTypeBindings, this._method.getTypeParameters());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:AnnotatedMethod.java

示例14: resolveParameterType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
public final JavaType resolveParameterType(int paramInt, TypeBindings paramTypeBindings)
{
  return paramTypeBindings.resolveType(getGenericParameterType(paramInt));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:AnnotatedWithParams.java

示例15: getType

import com.fasterxml.jackson.databind.type.TypeBindings; //导入依赖的package包/类
public JavaType getType(TypeBindings paramTypeBindings)
{
  return paramTypeBindings.resolveType(getGenericType());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:Annotated.java


注:本文中的com.fasterxml.jackson.databind.type.TypeBindings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。