本文整理汇总了Java中com.fasterxml.jackson.databind.SerializationConfig.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java SerializationConfig.isEnabled方法的具体用法?Java SerializationConfig.isEnabled怎么用?Java SerializationConfig.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.SerializationConfig
的用法示例。
在下文中一共展示了SerializationConfig.isEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processViews
import com.fasterxml.jackson.databind.SerializationConfig; //导入方法依赖的package包/类
protected void processViews(SerializationConfig paramSerializationConfig, BeanSerializerBuilder paramBeanSerializerBuilder)
{
List localList = paramBeanSerializerBuilder.getProperties();
boolean bool = paramSerializationConfig.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION);
int i = localList.size();
int j = 0;
BeanPropertyWriter[] arrayOfBeanPropertyWriter = new BeanPropertyWriter[i];
for (int k = 0; k < i; k++)
{
BeanPropertyWriter localBeanPropertyWriter = (BeanPropertyWriter)localList.get(k);
Class[] arrayOfClass = localBeanPropertyWriter.getViews();
if (arrayOfClass == null)
{
if (bool)
arrayOfBeanPropertyWriter[k] = localBeanPropertyWriter;
}
else
{
j++;
arrayOfBeanPropertyWriter[k] = constructFilteredBeanWriter(localBeanPropertyWriter, arrayOfClass);
}
}
if ((bool) && (j == 0))
return;
paramBeanSerializerBuilder.setFilteredProperties(arrayOfBeanPropertyWriter);
}
示例2: construct
import com.fasterxml.jackson.databind.SerializationConfig; //导入方法依赖的package包/类
public static EnumSerializer construct(Class<Enum<?>> paramClass, SerializationConfig paramSerializationConfig, BeanDescription paramBeanDescription, JsonFormat.Value paramValue)
{
AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
EnumValues localEnumValues;
if (paramSerializationConfig.isEnabled(SerializationFeature.WRITE_ENUMS_USING_TO_STRING))
localEnumValues = EnumValues.constructFromToString(paramClass, localAnnotationIntrospector);
else
localEnumValues = EnumValues.constructFromName(paramClass, localAnnotationIntrospector);
return new EnumSerializer(localEnumValues, _isShapeWrittenUsingIndex(paramClass, paramValue, true));
}
示例3: findBeanProperties
import com.fasterxml.jackson.databind.SerializationConfig; //导入方法依赖的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;
}
示例4: usesStaticTyping
import com.fasterxml.jackson.databind.SerializationConfig; //导入方法依赖的package包/类
protected boolean usesStaticTyping(SerializationConfig paramSerializationConfig, BeanDescription paramBeanDescription, TypeSerializer paramTypeSerializer)
{
if (paramTypeSerializer != null)
return false;
JsonSerialize.Typing localTyping = paramSerializationConfig.getAnnotationIntrospector().findSerializationTyping(paramBeanDescription.getClassInfo());
if (localTyping != null)
return localTyping == JsonSerialize.Typing.STATIC;
return paramSerializationConfig.isEnabled(MapperFeature.USE_STATIC_TYPING);
}
示例5: constructBeanSerializer
import com.fasterxml.jackson.databind.SerializationConfig; //导入方法依赖的package包/类
protected JsonSerializer<Object> constructBeanSerializer(SerializerProvider paramSerializerProvider, BeanDescription paramBeanDescription)
{
if (paramBeanDescription.getBeanClass() == Object.class)
return paramSerializerProvider.getUnknownTypeSerializer(Object.class);
SerializationConfig localSerializationConfig = paramSerializerProvider.getConfig();
BeanSerializerBuilder localBeanSerializerBuilder1 = constructBeanSerializerBuilder(paramBeanDescription);
BeanSerializerBuilder localBeanSerializerBuilder2 = localBeanSerializerBuilder1;
localBeanSerializerBuilder1.setConfig(localSerializationConfig);
List localList1 = findBeanProperties(paramSerializerProvider, paramBeanDescription, localBeanSerializerBuilder2);
Object localObject = localList1;
if (localList1 == null)
localObject = new ArrayList();
if (this._factoryConfig.hasSerializerModifiers())
{
Iterator localIterator3 = this._factoryConfig.serializerModifiers().iterator();
while (localIterator3.hasNext())
localObject = ((BeanSerializerModifier)localIterator3.next()).changeProperties(localSerializationConfig, paramBeanDescription, (List)localObject);
}
List localList2 = filterBeanProperties(localSerializationConfig, paramBeanDescription, (List)localObject);
if (this._factoryConfig.hasSerializerModifiers())
{
Iterator localIterator2 = this._factoryConfig.serializerModifiers().iterator();
while (localIterator2.hasNext())
localList2 = ((BeanSerializerModifier)localIterator2.next()).orderProperties(localSerializationConfig, paramBeanDescription, localList2);
}
localBeanSerializerBuilder2.setObjectIdWriter(constructObjectIdHandler(paramSerializerProvider, paramBeanDescription, localList2));
localBeanSerializerBuilder2.setProperties(localList2);
localBeanSerializerBuilder2.setFilterId(findFilterId(localSerializationConfig, paramBeanDescription));
AnnotatedMember localAnnotatedMember = paramBeanDescription.findAnyGetter();
if (localAnnotatedMember != null)
{
if (localSerializationConfig.canOverrideAccessModifiers())
localAnnotatedMember.fixAccess();
JavaType localJavaType1 = localAnnotatedMember.getType(paramBeanDescription.bindingsForBeanType());
boolean bool = localSerializationConfig.isEnabled(MapperFeature.USE_STATIC_TYPING);
JavaType localJavaType2 = localJavaType1.getContentType();
MapSerializer localMapSerializer = MapSerializer.construct(null, localJavaType1, bool, createTypeSerializer(localSerializationConfig, localJavaType2), null, null);
localBeanSerializerBuilder2.setAnyGetter(new AnyGetterWriter(new BeanProperty.Std(localAnnotatedMember.getName(), localJavaType2, null, paramBeanDescription.getClassAnnotations(), localAnnotatedMember, false), localAnnotatedMember, localMapSerializer));
}
processViews(localSerializationConfig, localBeanSerializerBuilder2);
if (this._factoryConfig.hasSerializerModifiers())
{
Iterator localIterator1 = this._factoryConfig.serializerModifiers().iterator();
while (localIterator1.hasNext())
localBeanSerializerBuilder2 = ((BeanSerializerModifier)localIterator1.next()).updateBuilder(localSerializationConfig, paramBeanDescription, localBeanSerializerBuilder2);
}
JsonSerializer localJsonSerializer = localBeanSerializerBuilder2.build();
if ((localJsonSerializer == null) && (paramBeanDescription.hasKnownClassAnnotations()))
return localBeanSerializerBuilder2.createDummy();
return localJsonSerializer;
}
示例6: testDateSerialization
import com.fasterxml.jackson.databind.SerializationConfig; //导入方法依赖的package包/类
/**
* Tests whether the dates are not serialized as timestamps, but as
* their textual representation.
*/
@Test
public void testDateSerialization() {
SerializationConfig serializationConfig = objectMapper.getSerializationConfig();
boolean writesDatesAsTimestamps = serializationConfig.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
assertFalse(writesDatesAsTimestamps);
}