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


Java Converter类代码示例

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


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

示例1: findConvertingContentSerializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
public JsonSerializer<?> findConvertingContentSerializer(SerializerProvider paramSerializerProvider, BeanProperty paramBeanProperty, JsonSerializer<?> paramJsonSerializer)
{
  AnnotationIntrospector localAnnotationIntrospector = paramSerializerProvider.getAnnotationIntrospector();
  if ((localAnnotationIntrospector != null) && (paramBeanProperty != null))
  {
    Object localObject = localAnnotationIntrospector.findSerializationContentConverter(paramBeanProperty.getMember());
    if (localObject != null)
    {
      Converter localConverter = paramSerializerProvider.converterInstance(paramBeanProperty.getMember(), localObject);
      JavaType localJavaType = localConverter.getOutputType(paramSerializerProvider.getTypeFactory());
      if (paramJsonSerializer == null)
        paramJsonSerializer = paramSerializerProvider.findValueSerializer(localJavaType, paramBeanProperty);
      return new StdDelegatingSerializer(localConverter, localJavaType, paramJsonSerializer);
    }
  }
  return paramJsonSerializer;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:StdSerializer.java

示例2: findConvertingContentDeserializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected JsonDeserializer<?> findConvertingContentDeserializer(DeserializationContext paramDeserializationContext, BeanProperty paramBeanProperty, JsonDeserializer<?> paramJsonDeserializer)
{
  AnnotationIntrospector localAnnotationIntrospector = paramDeserializationContext.getAnnotationIntrospector();
  if ((localAnnotationIntrospector != null) && (paramBeanProperty != null))
  {
    Object localObject = localAnnotationIntrospector.findDeserializationContentConverter(paramBeanProperty.getMember());
    if (localObject != null)
    {
      Converter localConverter = paramDeserializationContext.converterInstance(paramBeanProperty.getMember(), localObject);
      JavaType localJavaType = localConverter.getInputType(paramDeserializationContext.getTypeFactory());
      if (paramJsonDeserializer == null)
        paramJsonDeserializer = paramDeserializationContext.findContextualValueDeserializer(localJavaType, paramBeanProperty);
      return new StdDelegatingDeserializer(localConverter, localJavaType, paramJsonDeserializer);
    }
  }
  return paramJsonDeserializer;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:StdDeserializer.java

示例3: _createDeserializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected final JsonDeserializer<Object> _createDeserializer(DeserializationContext paramDeserializationContext, DeserializerFactory paramDeserializerFactory, JavaType paramJavaType)
{
  DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
  if ((paramJavaType.isAbstract()) || (paramJavaType.isMapLikeType()) || (paramJavaType.isCollectionLikeType()))
    paramJavaType = paramDeserializerFactory.mapAbstractType(localDeserializationConfig, paramJavaType);
  BeanDescription localBeanDescription = localDeserializationConfig.introspect(paramJavaType);
  JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationContext, localBeanDescription.getClassInfo());
  if (localJsonDeserializer != null)
    return localJsonDeserializer;
  JavaType localJavaType1 = modifyTypeByAnnotation(paramDeserializationContext, localBeanDescription.getClassInfo(), paramJavaType);
  if (localJavaType1 != paramJavaType)
  {
    paramJavaType = localJavaType1;
    localBeanDescription = localDeserializationConfig.introspect(localJavaType1);
  }
  Class localClass = localBeanDescription.findPOJOBuilder();
  if (localClass != null)
    return paramDeserializerFactory.createBuilderBasedDeserializer(paramDeserializationContext, paramJavaType, localBeanDescription, localClass);
  Converter localConverter = localBeanDescription.findDeserializationConverter();
  if (localConverter == null)
    return _createDeserializer2(paramDeserializationContext, paramDeserializerFactory, paramJavaType, localBeanDescription);
  JavaType localJavaType2 = localConverter.getInputType(paramDeserializationContext.getTypeFactory());
  if (!localJavaType2.hasRawClass(paramJavaType.getRawClass()))
    localBeanDescription = localDeserializationConfig.introspect(localJavaType2);
  return new StdDelegatingDeserializer(localConverter, localJavaType2, _createDeserializer2(paramDeserializationContext, paramDeserializerFactory, localJavaType2, localBeanDescription));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:27,代码来源:DeserializerCache.java

示例4: createContextual

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
public JsonSerializer<?> createContextual(SerializerProvider provider, BeanProperty property)
    throws JsonMappingException
{
    // First: figure out what is the fully generic delegate type:
    TypeFactory tf = provider.getTypeFactory();
    JavaType implType = tf.constructType(_converter.getClass());
    JavaType[] params = tf.findTypeParameters(implType, Converter.class);
    if (params == null || params.length != 2) {
        throw new JsonMappingException("Could not determine Converter parameterization for "
                +implType);
    }
    // and then we can find serializer to delegate to, construct a new instance:
    JavaType delegateType = params[1];
    return withDelegate(_converter, delegateType,
            provider.findValueSerializer(delegateType, property));
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:17,代码来源:StdDelegatingSerializer.java

示例5: createContextual

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
    throws JsonMappingException
{
    // First: figure out what is the fully generic delegate type:
    TypeFactory tf = ctxt.getTypeFactory();
    JavaType implType = tf.constructType(_converter.getClass());
    JavaType[] params = tf.findTypeParameters(implType, Converter.class);
    if (params == null || params.length != 2) {
        throw new JsonMappingException("Could not determine Converter parameterization for "
                +implType);
    }
    // and then we can find serializer to delegate to, construct a new instance:
    JavaType delegateType = params[0];
    return withDelegate(_converter, delegateType,
            ctxt.findContextualValueDeserializer(delegateType, property));
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:17,代码来源:StdDelegatingDeserializer.java

示例6: fromString

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
/** Helper function to create Converter from lambda **/
private <T> Converter<String, T> fromString(Function<String, ? extends T> fun) {
  return new StdConverter<String, T>() {
    @Override
    public T convert(String value) {
      return fun.apply(value);
    }
  };
}
 
开发者ID:dbmdz,项目名称:iiif-apis,代码行数:10,代码来源:IiifModule.java

示例7: toString

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
/** Helper function to create Converter from lambda **/
private <T> Converter<T, String> toString(Function<T, String> fun) {
  return new StdConverter<T, String>() {
    @Override
    public String convert(T value) {
      return fun.apply(value);
    }
  };
}
 
开发者ID:dbmdz,项目名称:iiif-apis,代码行数:10,代码来源:IiifModule.java

示例8: findConvertingSerializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected JsonSerializer<Object> findConvertingSerializer(SerializerProvider paramSerializerProvider, BeanPropertyWriter paramBeanPropertyWriter)
{
  AnnotationIntrospector localAnnotationIntrospector = paramSerializerProvider.getAnnotationIntrospector();
  if (localAnnotationIntrospector != null)
  {
    Object localObject = localAnnotationIntrospector.findSerializationConverter(paramBeanPropertyWriter.getMember());
    if (localObject != null)
    {
      Converter localConverter = paramSerializerProvider.converterInstance(paramBeanPropertyWriter.getMember(), localObject);
      JavaType localJavaType = localConverter.getOutputType(paramSerializerProvider.getTypeFactory());
      return new StdDelegatingSerializer(localConverter, localJavaType, paramSerializerProvider.findValueSerializer(localJavaType, paramBeanPropertyWriter));
    }
  }
  return null;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:16,代码来源:BeanSerializerBase.java

示例9: StdDelegatingSerializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
public StdDelegatingSerializer(Converter<?, ?> paramConverter)
{
  super(Object.class);
  this._converter = paramConverter;
  this._delegateType = null;
  this._delegateSerializer = null;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:StdDelegatingSerializer.java

示例10: createSerializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
public JsonSerializer<Object> createSerializer(SerializerProvider paramSerializerProvider, JavaType paramJavaType)
{
  SerializationConfig localSerializationConfig = paramSerializerProvider.getConfig();
  BeanDescription localBeanDescription = localSerializationConfig.introspect(paramJavaType);
  JsonSerializer localJsonSerializer = findSerializerFromAnnotation(paramSerializerProvider, localBeanDescription.getClassInfo());
  if (localJsonSerializer != null)
    return localJsonSerializer;
  JavaType localJavaType1 = modifyTypeByAnnotation(localSerializationConfig, localBeanDescription.getClassInfo(), paramJavaType);
  boolean bool;
  if (localJavaType1 == paramJavaType)
  {
    bool = false;
  }
  else
  {
    bool = true;
    if (!localJavaType1.hasRawClass(paramJavaType.getRawClass()))
      localBeanDescription = localSerializationConfig.introspect(localJavaType1);
  }
  Converter localConverter = localBeanDescription.findSerializationConverter();
  if (localConverter == null)
    return _createSerializer2(paramSerializerProvider, localJavaType1, localBeanDescription, bool);
  JavaType localJavaType2 = localConverter.getOutputType(paramSerializerProvider.getTypeFactory());
  if (!localJavaType2.hasRawClass(localJavaType1.getRawClass()))
    localBeanDescription = localSerializationConfig.introspect(localJavaType2);
  return new StdDelegatingSerializer(localConverter, localJavaType2, _createSerializer2(paramSerializerProvider, localJavaType2, localBeanDescription, true));
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:28,代码来源:BeanSerializerFactory.java

示例11: findConverter

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected Converter<Object, Object> findConverter(SerializerProvider paramSerializerProvider, Annotated paramAnnotated)
{
  Object localObject = paramSerializerProvider.getAnnotationIntrospector().findSerializationConverter(paramAnnotated);
  if (localObject == null)
    return null;
  return paramSerializerProvider.converterInstance(paramAnnotated, localObject);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:BasicSerializerFactory.java

示例12: findConvertingSerializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected JsonSerializer<?> findConvertingSerializer(SerializerProvider paramSerializerProvider, Annotated paramAnnotated, JsonSerializer<?> paramJsonSerializer)
{
  Converter localConverter = findConverter(paramSerializerProvider, paramAnnotated);
  if (localConverter == null)
    return paramJsonSerializer;
  return new StdDelegatingSerializer(localConverter, localConverter.getOutputType(paramSerializerProvider.getTypeFactory()), paramJsonSerializer);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:BasicSerializerFactory.java

示例13: StdDelegatingDeserializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
public StdDelegatingDeserializer(Converter<?, T> paramConverter)
{
  super(Object.class);
  this._converter = paramConverter;
  this._delegateType = null;
  this._delegateDeserializer = null;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:StdDelegatingDeserializer.java

示例14: findConverter

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected final Converter<Object, Object> findConverter(DeserializationContext paramDeserializationContext, Annotated paramAnnotated)
{
  Object localObject = paramDeserializationContext.getAnnotationIntrospector().findDeserializationConverter(paramAnnotated);
  if (localObject == null)
    return null;
  return paramDeserializationContext.converterInstance(paramAnnotated, localObject);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:DeserializerCache.java

示例15: findConvertingDeserializer

import com.fasterxml.jackson.databind.util.Converter; //导入依赖的package包/类
protected final JsonDeserializer<Object> findConvertingDeserializer(DeserializationContext paramDeserializationContext, Annotated paramAnnotated, JsonDeserializer<Object> paramJsonDeserializer)
{
  Converter localConverter = findConverter(paramDeserializationContext, paramAnnotated);
  if (localConverter == null)
    return paramJsonDeserializer;
  return new StdDelegatingDeserializer(localConverter, localConverter.getInputType(paramDeserializationContext.getTypeFactory()), paramJsonDeserializer);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:8,代码来源:DeserializerCache.java


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