本文整理匯總了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);
}
示例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;
}
示例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);
}
示例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());
}
示例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;
}