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


Java DeserializationConfig.canOverrideAccessModifiers方法代码示例

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


在下文中一共展示了DeserializationConfig.canOverrideAccessModifiers方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserializerForCreator

import com.fasterxml.jackson.databind.DeserializationConfig; //导入方法依赖的package包/类
public static JsonDeserializer<?> deserializerForCreator(DeserializationConfig paramDeserializationConfig, Class<?> paramClass, AnnotatedMethod paramAnnotatedMethod)
{
  Class localClass = paramAnnotatedMethod.getRawParameterType(0);
  Object localObject;
  if (localClass == String.class)
    localObject = null;
  else if ((localClass == Integer.TYPE) || (localClass == Integer.class))
    localObject = Integer.class;
  else if ((localClass == Long.TYPE) || (localClass == Long.class))
    localObject = Long.class;
  else
    throw new IllegalArgumentException("Parameter #0 type for factory method (" + paramAnnotatedMethod + ") not suitable, must be java.lang.String or int/Integer/long/Long");
  if (paramDeserializationConfig.canOverrideAccessModifiers())
    ClassUtil.checkAndFixAccess(paramAnnotatedMethod.getMember());
  return new FactoryBasedDeserializer(paramClass, paramAnnotatedMethod, (Class)localObject);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:17,代码来源:EnumDeserializer.java

示例2: findStringBasedKeyDeserializer

import com.fasterxml.jackson.databind.DeserializationConfig; //导入方法依赖的package包/类
public static KeyDeserializer findStringBasedKeyDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType)
{
  BeanDescription localBeanDescription = paramDeserializationConfig.introspect(paramJavaType);
  Constructor localConstructor = localBeanDescription.findSingleArgConstructor(new Class[] { String.class });
  if (localConstructor != null)
  {
    if (paramDeserializationConfig.canOverrideAccessModifiers())
      ClassUtil.checkAndFixAccess(localConstructor);
    return new StdKeyDeserializer.StringCtorKeyDeserializer(localConstructor);
  }
  Method localMethod = localBeanDescription.findFactoryMethod(new Class[] { String.class });
  if (localMethod != null)
  {
    if (paramDeserializationConfig.canOverrideAccessModifiers())
      ClassUtil.checkAndFixAccess(localMethod);
    return new StdKeyDeserializer.StringFactoryKeyDeserializer(localMethod);
  }
  return null;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:StdKeyDeserializers.java

示例3: _createEnumKeyDeserializer

import com.fasterxml.jackson.databind.DeserializationConfig; //导入方法依赖的package包/类
private KeyDeserializer _createEnumKeyDeserializer(DeserializationContext paramDeserializationContext, JavaType paramJavaType)
{
  DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
  BeanDescription localBeanDescription = localDeserializationConfig.introspect(paramJavaType);
  JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationContext, localBeanDescription.getClassInfo());
  if (localJsonDeserializer != null)
    return StdKeyDeserializers.constructDelegatingKeyDeserializer(localDeserializationConfig, paramJavaType, localJsonDeserializer);
  Class localClass = paramJavaType.getRawClass();
  if (_findCustomEnumDeserializer(localClass, localDeserializationConfig, localBeanDescription) != null)
    return StdKeyDeserializers.constructDelegatingKeyDeserializer(localDeserializationConfig, paramJavaType, localJsonDeserializer);
  EnumResolver localEnumResolver = constructEnumResolver(localClass, localDeserializationConfig, localBeanDescription.findJsonValueMethod());
  Iterator localIterator = localBeanDescription.getFactoryMethods().iterator();
  while (localIterator.hasNext())
  {
    AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator.next();
    if (localDeserializationConfig.getAnnotationIntrospector().hasCreatorAnnotation(localAnnotatedMethod))
    {
      if ((localAnnotatedMethod.getParameterCount() == 1) && (localAnnotatedMethod.getRawReturnType().isAssignableFrom(localClass)))
      {
        if (localAnnotatedMethod.getGenericParameterType(0) != String.class)
          throw new IllegalArgumentException("Parameter #0 type for factory method (" + localAnnotatedMethod + ") not suitable, must be java.lang.String");
        if (localDeserializationConfig.canOverrideAccessModifiers())
          ClassUtil.checkAndFixAccess(localAnnotatedMethod.getMember());
        return StdKeyDeserializers.constructEnumKeyDeserializer(localEnumResolver, localAnnotatedMethod);
      }
      throw new IllegalArgumentException("Unsuitable method (" + localAnnotatedMethod + ") decorated with @JsonCreator (for Enum type " + localClass.getName() + ")");
    }
  }
  return StdKeyDeserializers.constructEnumKeyDeserializer(localEnumResolver);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:31,代码来源:BasicDeserializerFactory.java

示例4: constructEnumResolver

import com.fasterxml.jackson.databind.DeserializationConfig; //导入方法依赖的package包/类
protected EnumResolver<?> constructEnumResolver(Class<?> paramClass, DeserializationConfig paramDeserializationConfig, AnnotatedMethod paramAnnotatedMethod)
{
  if (paramAnnotatedMethod != null)
  {
    Method localMethod = paramAnnotatedMethod.getAnnotated();
    if (paramDeserializationConfig.canOverrideAccessModifiers())
      ClassUtil.checkAndFixAccess(localMethod);
    return EnumResolver.constructUnsafeUsingMethod(paramClass, localMethod);
  }
  if (paramDeserializationConfig.isEnabled(DeserializationFeature.READ_ENUMS_USING_TO_STRING))
    return EnumResolver.constructUnsafeUsingToString(paramClass);
  return EnumResolver.constructUnsafe(paramClass, paramDeserializationConfig.getAnnotationIntrospector());
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:14,代码来源:BasicDeserializerFactory.java

示例5: buildBuilderBasedDeserializer

import com.fasterxml.jackson.databind.DeserializationConfig; //导入方法依赖的package包/类
protected JsonDeserializer<Object> buildBuilderBasedDeserializer(DeserializationContext paramDeserializationContext, JavaType paramJavaType, BeanDescription paramBeanDescription)
{
  ValueInstantiator localValueInstantiator = findValueInstantiator(paramDeserializationContext, paramBeanDescription);
  DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
  BeanDeserializerBuilder localBeanDeserializerBuilder1 = constructBeanDeserializerBuilder(paramDeserializationContext, paramBeanDescription);
  BeanDeserializerBuilder localBeanDeserializerBuilder2 = localBeanDeserializerBuilder1;
  localBeanDeserializerBuilder1.setValueInstantiator(localValueInstantiator);
  addBeanProps(paramDeserializationContext, paramBeanDescription, localBeanDeserializerBuilder2);
  addObjectIdReader(paramDeserializationContext, paramBeanDescription, localBeanDeserializerBuilder2);
  addReferenceProperties(paramDeserializationContext, paramBeanDescription, localBeanDeserializerBuilder2);
  addInjectables(paramDeserializationContext, paramBeanDescription, localBeanDeserializerBuilder2);
  JsonPOJOBuilder.Value localValue = paramBeanDescription.findPOJOBuilderConfig();
  String str;
  if (localValue == null)
    str = "build";
  else
    str = localValue.buildMethodName;
  AnnotatedMethod localAnnotatedMethod = paramBeanDescription.findMethod(str, null);
  if ((localAnnotatedMethod != null) && (localDeserializationConfig.canOverrideAccessModifiers()))
    ClassUtil.checkAndFixAccess(localAnnotatedMethod.getMember());
  localBeanDeserializerBuilder2.setPOJOBuilder(localAnnotatedMethod, localValue);
  if (this._factoryConfig.hasDeserializerModifiers())
  {
    Iterator localIterator2 = this._factoryConfig.deserializerModifiers().iterator();
    while (localIterator2.hasNext())
      localBeanDeserializerBuilder2 = ((BeanDeserializerModifier)localIterator2.next()).updateBuilder(localDeserializationConfig, paramBeanDescription, localBeanDeserializerBuilder2);
  }
  JsonDeserializer localJsonDeserializer = localBeanDeserializerBuilder2.buildBuilderBased(paramJavaType, str);
  if (this._factoryConfig.hasDeserializerModifiers())
  {
    Iterator localIterator1 = this._factoryConfig.deserializerModifiers().iterator();
    while (localIterator1.hasNext())
      localJsonDeserializer = ((BeanDeserializerModifier)localIterator1.next()).modifyDeserializer(localDeserializationConfig, paramBeanDescription, localJsonDeserializer);
  }
  return localJsonDeserializer;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:37,代码来源:BeanDeserializerFactory.java


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