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


Java SerializationConfig.isEnabled方法代码示例

本文整理汇总了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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:27,代码来源:BeanSerializerFactory.java

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

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

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

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

示例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);
}
 
开发者ID:terrestris,项目名称:shogun2,代码行数:14,代码来源:Shogun2JsonObjectMapperTest.java


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