Java 类org.codehaus.jackson.map.SerializationConfig.Feature 实例源码

项目:jetstream    文件:JsonResourceFormatter.java   
@Override
protected void formatBean(Object objBean) throws Exception {
    IdentityHashMap identityHashMap = new IdentityHashMap();
    // root object
    Map<String, Object> json = new HashMap<String, Object>();

    // set desc and type on root
    Class<?> clazz = objBean.getClass();
    ManagedResource mr = clazz.getAnnotation(ManagedResource.class);
    String strHelp = mr == null ? null : mr.description();
    if (strHelp != null)
        json.put("description", strHelp);
    json.put("bean", clazz.getName());

    identityHashMap.put(objBean, Boolean.TRUE);

    // add properties and operations, recursively as needed
    format(objBean, json, identityHashMap);

    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
    // Output
    getWriter().print(mapper.writeValueAsString(json));
}
项目:12306-android-Decompile    文件:BeanSerializerFactory.java   
protected BeanPropertyWriter _constructWriter(SerializationConfig paramSerializationConfig, TypeBindings paramTypeBindings, PropertyBuilder paramPropertyBuilder, boolean paramBoolean, String paramString, AnnotatedMember paramAnnotatedMember)
  throws JsonMappingException
{
  if (paramSerializationConfig.isEnabled(SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS))
    paramAnnotatedMember.fixAccess();
  JavaType localJavaType = paramAnnotatedMember.getType(paramTypeBindings);
  BeanProperty.Std localStd = new BeanProperty.Std(paramString, localJavaType, paramPropertyBuilder.getClassAnnotations(), paramAnnotatedMember);
  JsonSerializer localJsonSerializer = findSerializerFromAnnotation(paramSerializationConfig, paramAnnotatedMember, localStd);
  boolean bool = ClassUtil.isCollectionMapOrArray(localJavaType.getRawClass());
  TypeSerializer localTypeSerializer = null;
  if (bool)
    localTypeSerializer = findPropertyContentTypeSerializer(localJavaType, paramSerializationConfig, paramAnnotatedMember, localStd);
  BeanPropertyWriter localBeanPropertyWriter = paramPropertyBuilder.buildWriter(paramString, localJavaType, localJsonSerializer, findPropertyTypeSerializer(localJavaType, paramSerializationConfig, paramAnnotatedMember, localStd), localTypeSerializer, paramAnnotatedMember, paramBoolean);
  localBeanPropertyWriter.setViews(paramSerializationConfig.getAnnotationIntrospector().findSerializationViews(paramAnnotatedMember));
  return localBeanPropertyWriter;
}
项目:12306-android-Decompile    文件:JodaSerializers.java   
public void serialize(LocalDateTime paramLocalDateTime, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeStartArray();
    paramJsonGenerator.writeNumber(paramLocalDateTime.year().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.monthOfYear().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.dayOfMonth().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.hourOfDay().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.minuteOfHour().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.secondOfMinute().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.millisOfSecond().get());
    paramJsonGenerator.writeEndArray();
    return;
  }
  paramJsonGenerator.writeString(printLocalDateTime(paramLocalDateTime));
}
项目:12306-android-Decompile    文件:BeanSerializerFactory.java   
protected BeanPropertyWriter _constructWriter(SerializationConfig paramSerializationConfig, TypeBindings paramTypeBindings, PropertyBuilder paramPropertyBuilder, boolean paramBoolean, String paramString, AnnotatedMember paramAnnotatedMember)
  throws JsonMappingException
{
  if (paramSerializationConfig.isEnabled(SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS))
    paramAnnotatedMember.fixAccess();
  JavaType localJavaType = paramAnnotatedMember.getType(paramTypeBindings);
  BeanProperty.Std localStd = new BeanProperty.Std(paramString, localJavaType, paramPropertyBuilder.getClassAnnotations(), paramAnnotatedMember);
  JsonSerializer localJsonSerializer = findSerializerFromAnnotation(paramSerializationConfig, paramAnnotatedMember, localStd);
  boolean bool = ClassUtil.isCollectionMapOrArray(localJavaType.getRawClass());
  TypeSerializer localTypeSerializer = null;
  if (bool)
    localTypeSerializer = findPropertyContentTypeSerializer(localJavaType, paramSerializationConfig, paramAnnotatedMember, localStd);
  BeanPropertyWriter localBeanPropertyWriter = paramPropertyBuilder.buildWriter(paramString, localJavaType, localJsonSerializer, findPropertyTypeSerializer(localJavaType, paramSerializationConfig, paramAnnotatedMember, localStd), localTypeSerializer, paramAnnotatedMember, paramBoolean);
  localBeanPropertyWriter.setViews(paramSerializationConfig.getAnnotationIntrospector().findSerializationViews(paramAnnotatedMember));
  return localBeanPropertyWriter;
}
项目:12306-android-Decompile    文件:JodaSerializers.java   
public void serialize(LocalDateTime paramLocalDateTime, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeStartArray();
    paramJsonGenerator.writeNumber(paramLocalDateTime.year().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.monthOfYear().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.dayOfMonth().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.hourOfDay().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.minuteOfHour().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.secondOfMinute().get());
    paramJsonGenerator.writeNumber(paramLocalDateTime.millisOfSecond().get());
    paramJsonGenerator.writeEndArray();
    return;
  }
  paramJsonGenerator.writeString(printLocalDateTime(paramLocalDateTime));
}
项目:gbif-api    文件:TermMapListSerializer.java   
@Override
public void serialize(List<Map<Term, String>> value, JsonGenerator jgen, SerializerProvider provider)
  throws IOException {
  if ((value == null || value.isEmpty()) && provider.getConfig().isEnabled(Feature.WRITE_EMPTY_JSON_ARRAYS)) {
    jgen.writeStartArray();
    jgen.writeEndArray();
  } else {
    jgen.writeStartArray();
    for (Map<Term, String> extension : value) {
      jgen.writeStartObject();
      for (Entry<Term, String> entry : extension.entrySet()) {
        jgen.writeStringField(entry.getKey().qualifiedName(), entry.getValue());
      }
      jgen.writeEndObject();
    }
    jgen.writeEndArray();
  }
}
项目:ingress-indonesia-dev    文件:SerializerBase.java   
public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, int paramInt)
{
  for (Throwable localThrowable = paramThrowable; ((localThrowable instanceof InvocationTargetException)) && (localThrowable.getCause() != null); localThrowable = localThrowable.getCause());
  if ((localThrowable instanceof Error))
    throw ((Error)localThrowable);
  if ((paramSerializerProvider == null) || (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)));
  for (int i = 1; (localThrowable instanceof IOException); i = 0)
  {
    if ((i != 0) && ((localThrowable instanceof JsonMappingException)))
      break label112;
    throw ((IOException)localThrowable);
  }
  if ((i == 0) && ((localThrowable instanceof RuntimeException)))
    throw ((RuntimeException)localThrowable);
  label112: throw JsonMappingException.wrapWithPath(localThrowable, paramObject, paramInt);
}
项目:ingress-indonesia-dev    文件:SerializerBase.java   
public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, String paramString)
{
  for (Throwable localThrowable = paramThrowable; ((localThrowable instanceof InvocationTargetException)) && (localThrowable.getCause() != null); localThrowable = localThrowable.getCause());
  if ((localThrowable instanceof Error))
    throw ((Error)localThrowable);
  if ((paramSerializerProvider == null) || (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)));
  for (int i = 1; (localThrowable instanceof IOException); i = 0)
  {
    if ((i != 0) && ((localThrowable instanceof JsonMappingException)))
      break label112;
    throw ((IOException)localThrowable);
  }
  if ((i == 0) && ((localThrowable instanceof RuntimeException)))
    throw ((RuntimeException)localThrowable);
  label112: throw JsonMappingException.wrapWithPath(localThrowable, paramObject, paramString);
}
项目:occurrence    文件:ExtensionSerDeserUtils.java   
@Override
public void serialize(List<Map<Term, String>> value, JsonGenerator jgen, SerializerProvider provider)
  throws IOException {
  if ((value == null || value.isEmpty()) && provider.getConfig().isEnabled(Feature.WRITE_EMPTY_JSON_ARRAYS)) {
    jgen.writeStartArray();
    jgen.writeEndArray();
  } else {
    jgen.writeStartArray();
    for (Map<Term, String> extension : value) {
      jgen.writeStartObject();
      for (Entry<Term, String> entry : extension.entrySet()) {
        jgen.writeStringField(entry.getKey().qualifiedName(), entry.getValue());
      }
      jgen.writeEndObject();
    }
    jgen.writeEndArray();
  }
}
项目:aliyun-oss-hadoop-fs    文件:FileSystemTimelineWriter.java   
private ObjectMapper createObjectMapper() {
  ObjectMapper mapper = new ObjectMapper();
  mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());
  mapper.setSerializationInclusion(Inclusion.NON_NULL);
  mapper.configure(Feature.CLOSE_CLOSEABLE, false);
  return mapper;
}
项目:SEE-HLA-Starter-Kit    文件:ConfigurationFactory.java   
private ObjectMapper getObjectMapper() {
    if(mapper == null){
         mapper = new ObjectMapper();
         mapper.configure(Feature.SORT_PROPERTIES_ALPHABETICALLY , true);
         mapper.configure(Feature.WRITE_DATES_AS_TIMESTAMPS, false);
    }
    return mapper;
}
项目:SimpleJavaServer    文件:DefaultObjectMapperProvider.java   
private static ObjectMapper createDefaultMapper() {
    final ObjectMapper result = new ObjectMapper();

    //To make things look pretty when it gets converted
    result.configure(Feature.INDENT_OUTPUT, true);

    return result;
}
项目:hops    文件:FileSystemTimelineWriter.java   
private ObjectMapper createObjectMapper() {
  ObjectMapper mapper = new ObjectMapper();
  mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());
  mapper.setSerializationInclusion(Inclusion.NON_NULL);
  mapper.configure(Feature.CLOSE_CLOSEABLE, false);
  mapper.configure(Feature.FLUSH_AFTER_WRITE_VALUE, false);
  return mapper;
}
项目:ecru    文件:RestObjectMapperProvider.java   
private static ObjectMapper createMapper() {

    final ObjectMapper mapper = new ObjectMapper();
    mapper.configure(Feature.INDENT_OUTPUT, true);
    mapper.configure(Feature.WRITE_NULL_MAP_VALUES, false);
    // the next piece is from http://wiki.fasterxml.com/JacksonFAQDateHandling
    mapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
    mapper.setSerializationConfig(mapper.getSerializationConfig().withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL));
    return mapper;

}
项目:detective    文件:JacksonMsgConverter.java   
public JacksonMsgConverter(boolean failOnUnknowProperties) {
  configure(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES,
      failOnUnknowProperties);
  configure(Feature.WRITE_DATES_AS_TIMESTAMPS, false);
  SimpleDateFormat format = new SimpleDateFormat(FULLTIME_FORMAT);
  format.setTimeZone(TimeZone.getTimeZone("UTC"));
  setDateFormat(format);
}
项目:12306-android-Decompile    文件:ArraySerializers.java   
public void serialize(char[] paramArrayOfChar, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS))
  {
    paramJsonGenerator.writeStartArray();
    _writeArrayContents(paramJsonGenerator, paramArrayOfChar);
    paramJsonGenerator.writeEndArray();
    return;
  }
  paramJsonGenerator.writeString(paramArrayOfChar, 0, paramArrayOfChar.length);
}
项目:12306-android-Decompile    文件:ArraySerializers.java   
public void serializeWithType(char[] paramArrayOfChar, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, TypeSerializer paramTypeSerializer)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS))
  {
    paramTypeSerializer.writeTypePrefixForArray(paramArrayOfChar, paramJsonGenerator);
    _writeArrayContents(paramJsonGenerator, paramArrayOfChar);
    paramTypeSerializer.writeTypeSuffixForArray(paramArrayOfChar, paramJsonGenerator);
    return;
  }
  paramTypeSerializer.writeTypePrefixForScalar(paramArrayOfChar, paramJsonGenerator);
  paramJsonGenerator.writeString(paramArrayOfChar, 0, paramArrayOfChar.length);
  paramTypeSerializer.writeTypeSuffixForScalar(paramArrayOfChar, paramJsonGenerator);
}
项目:12306-android-Decompile    文件:JsonValueSerializer.java   
public void resolve(SerializerProvider paramSerializerProvider)
  throws JsonMappingException
{
  if ((this._valueSerializer == null) && ((paramSerializerProvider.isEnabled(SerializationConfig.Feature.USE_STATIC_TYPING)) || (Modifier.isFinal(this._accessorMethod.getReturnType().getModifiers()))))
  {
    JavaType localJavaType = paramSerializerProvider.constructType(this._accessorMethod.getGenericReturnType());
    this._valueSerializer = paramSerializerProvider.findTypedValueSerializer(localJavaType, false, this._property);
    this._forceTypeInformation = isNaturalTypeWithStdHandling(localJavaType, this._valueSerializer);
  }
}
项目:12306-android-Decompile    文件:SerializerBase.java   
public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, int paramInt)
  throws IOException
{
  while (((paramThrowable instanceof InvocationTargetException)) && (paramThrowable.getCause() != null))
    paramThrowable = paramThrowable.getCause();
  if ((paramThrowable instanceof Error))
    throw ((Error)paramThrowable);
  int i;
  if ((paramSerializerProvider == null) || (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)))
    i = 1;
  while (true)
    if ((paramThrowable instanceof IOException))
    {
      if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
        break;
      throw ((IOException)paramThrowable);
      i = 0;
      continue;
    }
    else
    {
      if ((i != 0) || (!(paramThrowable instanceof RuntimeException)))
        break;
      throw ((RuntimeException)paramThrowable);
    }
  throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramInt);
}
项目:12306-android-Decompile    文件:SerializerBase.java   
public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, String paramString)
  throws IOException
{
  while (((paramThrowable instanceof InvocationTargetException)) && (paramThrowable.getCause() != null))
    paramThrowable = paramThrowable.getCause();
  if ((paramThrowable instanceof Error))
    throw ((Error)paramThrowable);
  int i;
  if ((paramSerializerProvider == null) || (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)))
    i = 1;
  while (true)
    if ((paramThrowable instanceof IOException))
    {
      if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
        break;
      throw ((IOException)paramThrowable);
      i = 0;
      continue;
    }
    else
    {
      if ((i != 0) || (!(paramThrowable instanceof RuntimeException)))
        break;
      throw ((RuntimeException)paramThrowable);
    }
  throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramString);
}
项目:12306-android-Decompile    文件:BeanSerializerFactory.java   
protected void processViews(SerializationConfig paramSerializationConfig, BeanSerializerBuilder paramBeanSerializerBuilder)
{
  List localList = paramBeanSerializerBuilder.getProperties();
  boolean bool = paramSerializationConfig.isEnabled(SerializationConfig.Feature.DEFAULT_VIEW_INCLUSION);
  int i = localList.size();
  int j = 0;
  BeanPropertyWriter[] arrayOfBeanPropertyWriter = new BeanPropertyWriter[i];
  int k = 0;
  if (k < i)
  {
    BeanPropertyWriter localBeanPropertyWriter = (BeanPropertyWriter)localList.get(k);
    Class[] arrayOfClass = localBeanPropertyWriter.getViews();
    if (arrayOfClass == null)
      if (bool)
        arrayOfBeanPropertyWriter[k] = localBeanPropertyWriter;
    while (true)
    {
      k++;
      break;
      j++;
      arrayOfBeanPropertyWriter[k] = constructFilteredBeanWriter(localBeanPropertyWriter, arrayOfClass);
    }
  }
  if ((bool) && (j == 0))
    return;
  paramBeanSerializerBuilder.setFilteredProperties(arrayOfBeanPropertyWriter);
}
项目:12306-android-Decompile    文件:BeanSerializerFactory.java   
protected List<BeanPropertyWriter> sortBeanProperties(SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription, List<BeanPropertyWriter> paramList)
{
  List localList = paramBasicBeanDescription.findCreatorPropertyNames();
  AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
  AnnotatedClass localAnnotatedClass = paramBasicBeanDescription.getClassInfo();
  String[] arrayOfString = localAnnotationIntrospector.findSerializationPropertyOrder(localAnnotatedClass);
  Boolean localBoolean = localAnnotationIntrospector.findSerializationSortAlphabetically(localAnnotatedClass);
  if (localBoolean == null);
  for (boolean bool = paramSerializationConfig.isEnabled(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY); ; bool = localBoolean.booleanValue())
  {
    if ((bool) || (!localList.isEmpty()) || (arrayOfString != null))
      paramList = _sortBeanProperties(paramList, localList, arrayOfString, bool);
    return paramList;
  }
}
项目:12306-android-Decompile    文件:StdSerializerProvider.java   
public void serialize(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonMappingException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS))
    failForEmpty(paramObject);
  paramJsonGenerator.writeStartObject();
  paramJsonGenerator.writeEndObject();
}
项目:12306-android-Decompile    文件:StdSerializerProvider.java   
public final void serializeWithType(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, TypeSerializer paramTypeSerializer)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS))
    failForEmpty(paramObject);
  paramTypeSerializer.writeTypePrefixForObject(paramObject, paramJsonGenerator);
  paramTypeSerializer.writeTypeSuffixForObject(paramObject, paramJsonGenerator);
}
项目:12306-android-Decompile    文件:StdSerializerProvider.java   
protected void _serializeValue(JsonGenerator paramJsonGenerator, Object paramObject)
  throws IOException, JsonProcessingException
{
  JsonSerializer localJsonSerializer;
  boolean bool;
  if (paramObject == null)
  {
    localJsonSerializer = getNullValueSerializer();
    bool = false;
  }
  String str;
  try
  {
    while (true)
    {
      localJsonSerializer.serialize(paramObject, paramJsonGenerator, this);
      if (bool)
        paramJsonGenerator.writeEndObject();
      return;
      localJsonSerializer = findTypedValueSerializer(paramObject.getClass(), true, null);
      bool = this._config.isEnabled(SerializationConfig.Feature.WRAP_ROOT_VALUE);
      if (!bool)
        continue;
      paramJsonGenerator.writeStartObject();
      paramJsonGenerator.writeFieldName(this._rootNames.findRootName(paramObject.getClass(), this._config));
    }
  }
  catch (IOException localIOException)
  {
    throw localIOException;
  }
  catch (Exception localException)
  {
    str = localException.getMessage();
    if (str == null)
      str = "[no message for " + localException.getClass().getName() + "]";
  }
  throw new JsonMappingException(str, localException);
}
项目:12306-android-Decompile    文件:StdSerializerProvider.java   
public final void defaultSerializeDateValue(long paramLong, JsonGenerator paramJsonGenerator)
  throws IOException, JsonProcessingException
{
  if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeNumber(paramLong);
    return;
  }
  if (this._dateFormat == null)
    this._dateFormat = ((DateFormat)this._config.getDateFormat().clone());
  paramJsonGenerator.writeString(this._dateFormat.format(new Date(paramLong)));
}
项目:12306-android-Decompile    文件:StdSerializerProvider.java   
public final void defaultSerializeDateValue(Date paramDate, JsonGenerator paramJsonGenerator)
  throws IOException, JsonProcessingException
{
  if (isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeNumber(paramDate.getTime());
    return;
  }
  if (this._dateFormat == null)
    this._dateFormat = ((DateFormat)this._config.getDateFormat().clone());
  paramJsonGenerator.writeString(this._dateFormat.format(paramDate));
}
项目:12306-android-Decompile    文件:EnumSerializer.java   
public static EnumSerializer construct(Class<Enum<?>> paramClass, SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription)
{
  AnnotationIntrospector localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
  if (paramSerializationConfig.isEnabled(SerializationConfig.Feature.WRITE_ENUMS_USING_TO_STRING));
  for (EnumValues localEnumValues = EnumValues.constructFromToString(paramClass, localAnnotationIntrospector); ; localEnumValues = EnumValues.constructFromName(paramClass, localAnnotationIntrospector))
    return new EnumSerializer(localEnumValues);
}
项目:12306-android-Decompile    文件:PropertyBuilder.java   
protected Object getDefaultBean()
{
  if (this._defaultBean == null)
  {
    this._defaultBean = this._beanDesc.instantiateBean(this._config.isEnabled(SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS));
    if (this._defaultBean == null)
    {
      Class localClass = this._beanDesc.getClassInfo().getAnnotated();
      throw new IllegalArgumentException("Class " + localClass.getName() + " has no default constructor; can not instantiate default bean value to support 'properties=JsonSerialize.Inclusion.NON_DEFAULT' annotation");
    }
  }
  return this._defaultBean;
}
项目:12306-android-Decompile    文件:BasicSerializerFactory.java   
protected boolean usesStaticTyping(SerializationConfig paramSerializationConfig, BasicBeanDescription paramBasicBeanDescription, TypeSerializer paramTypeSerializer, BeanProperty paramBeanProperty)
{
  if (paramTypeSerializer != null);
  AnnotationIntrospector localAnnotationIntrospector;
  JavaType localJavaType;
  do
  {
    do
    {
      do
      {
        return false;
        localAnnotationIntrospector = paramSerializationConfig.getAnnotationIntrospector();
        JsonSerialize.Typing localTyping = localAnnotationIntrospector.findSerializationTyping(paramBasicBeanDescription.getClassInfo());
        if (localTyping != null)
        {
          if (localTyping == JsonSerialize.Typing.STATIC)
            return true;
        }
        else if (paramSerializationConfig.isEnabled(SerializationConfig.Feature.USE_STATIC_TYPING))
          return true;
      }
      while (paramBeanProperty == null);
      localJavaType = paramBeanProperty.getType();
    }
    while (!localJavaType.isContainerType());
    if (localAnnotationIntrospector.findSerializationContentType(paramBeanProperty.getMember(), paramBeanProperty.getType()) != null)
      return true;
  }
  while ((!(localJavaType instanceof MapType)) || (localAnnotationIntrospector.findSerializationKeyType(paramBeanProperty.getMember(), paramBeanProperty.getType()) == null));
  return true;
}
项目:12306-android-Decompile    文件:JodaSerializers.java   
public void serialize(DateMidnight paramDateMidnight, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeStartArray();
    paramJsonGenerator.writeNumber(paramDateMidnight.year().get());
    paramJsonGenerator.writeNumber(paramDateMidnight.monthOfYear().get());
    paramJsonGenerator.writeNumber(paramDateMidnight.dayOfMonth().get());
    paramJsonGenerator.writeEndArray();
    return;
  }
  paramJsonGenerator.writeString(printLocalDate(paramDateMidnight));
}
项目:12306-android-Decompile    文件:JodaSerializers.java   
public void serialize(DateTime paramDateTime, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeNumber(paramDateTime.getMillis());
    return;
  }
  paramJsonGenerator.writeString(paramDateTime.toString());
}
项目:12306-android-Decompile    文件:JodaSerializers.java   
public void serialize(LocalDate paramLocalDate, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS))
  {
    paramJsonGenerator.writeStartArray();
    paramJsonGenerator.writeNumber(paramLocalDate.year().get());
    paramJsonGenerator.writeNumber(paramLocalDate.monthOfYear().get());
    paramJsonGenerator.writeNumber(paramLocalDate.dayOfMonth().get());
    paramJsonGenerator.writeEndArray();
    return;
  }
  paramJsonGenerator.writeString(printLocalDate(paramLocalDate));
}
项目:teknek-core    文件:BundleGenerator.java   
public static void main(String [] args) throws JsonGenerationException, JsonMappingException, IOException{
  Bundle b = new Bundle();
  b.setBundleName("itests");
  b.setPackageName("io.teknek");
  b.getFeedDescList().add(TestDriverFactory.buildPureGroovyFeedDesc());
  b.getOperatorList().add(TestDriverFactory.getIdentityGroovyOperator());
  ObjectMapper om = new ObjectMapper();
  om.getSerializationConfig().set(Feature.INDENT_OUTPUT, true);
  System.out.println( om.writeValueAsString(b) );
}
项目:hraven    文件:ObjectMapperProvider.java   
public static ObjectMapper createCustomMapper() {
  ObjectMapper result = new ObjectMapper();
  result.configure(Feature.INDENT_OUTPUT, true);
  SimpleModule module = createhRavenModule();
  addJobMappings(module);
  module.addSerializer(Flow.class, new FlowSerializer());
  module.addSerializer(AppSummary.class, new AppSummarySerializer());
  module.addSerializer(TaskDetails.class, new TaskDetailsSerializer());
  module.addSerializer(JobDetails.class, new JobDetailsSerializer());
  result.registerModule(module);
  return result;
}
项目:12306-android-Decompile    文件:ArraySerializers.java   
public void serialize(char[] paramArrayOfChar, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS))
  {
    paramJsonGenerator.writeStartArray();
    _writeArrayContents(paramJsonGenerator, paramArrayOfChar);
    paramJsonGenerator.writeEndArray();
    return;
  }
  paramJsonGenerator.writeString(paramArrayOfChar, 0, paramArrayOfChar.length);
}
项目:12306-android-Decompile    文件:ArraySerializers.java   
public void serializeWithType(char[] paramArrayOfChar, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, TypeSerializer paramTypeSerializer)
  throws IOException, JsonGenerationException
{
  if (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS))
  {
    paramTypeSerializer.writeTypePrefixForArray(paramArrayOfChar, paramJsonGenerator);
    _writeArrayContents(paramJsonGenerator, paramArrayOfChar);
    paramTypeSerializer.writeTypeSuffixForArray(paramArrayOfChar, paramJsonGenerator);
    return;
  }
  paramTypeSerializer.writeTypePrefixForScalar(paramArrayOfChar, paramJsonGenerator);
  paramJsonGenerator.writeString(paramArrayOfChar, 0, paramArrayOfChar.length);
  paramTypeSerializer.writeTypeSuffixForScalar(paramArrayOfChar, paramJsonGenerator);
}
项目:12306-android-Decompile    文件:JsonValueSerializer.java   
public void resolve(SerializerProvider paramSerializerProvider)
  throws JsonMappingException
{
  if ((this._valueSerializer == null) && ((paramSerializerProvider.isEnabled(SerializationConfig.Feature.USE_STATIC_TYPING)) || (Modifier.isFinal(this._accessorMethod.getReturnType().getModifiers()))))
  {
    JavaType localJavaType = paramSerializerProvider.constructType(this._accessorMethod.getGenericReturnType());
    this._valueSerializer = paramSerializerProvider.findTypedValueSerializer(localJavaType, false, this._property);
    this._forceTypeInformation = isNaturalTypeWithStdHandling(localJavaType, this._valueSerializer);
  }
}
项目:12306-android-Decompile    文件:SerializerBase.java   
public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, int paramInt)
  throws IOException
{
  while (((paramThrowable instanceof InvocationTargetException)) && (paramThrowable.getCause() != null))
    paramThrowable = paramThrowable.getCause();
  if ((paramThrowable instanceof Error))
    throw ((Error)paramThrowable);
  int i;
  if ((paramSerializerProvider == null) || (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)))
    i = 1;
  while (true)
    if ((paramThrowable instanceof IOException))
    {
      if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
        break;
      throw ((IOException)paramThrowable);
      i = 0;
      continue;
    }
    else
    {
      if ((i != 0) || (!(paramThrowable instanceof RuntimeException)))
        break;
      throw ((RuntimeException)paramThrowable);
    }
  throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramInt);
}
项目:12306-android-Decompile    文件:SerializerBase.java   
public void wrapAndThrow(SerializerProvider paramSerializerProvider, Throwable paramThrowable, Object paramObject, String paramString)
  throws IOException
{
  while (((paramThrowable instanceof InvocationTargetException)) && (paramThrowable.getCause() != null))
    paramThrowable = paramThrowable.getCause();
  if ((paramThrowable instanceof Error))
    throw ((Error)paramThrowable);
  int i;
  if ((paramSerializerProvider == null) || (paramSerializerProvider.isEnabled(SerializationConfig.Feature.WRAP_EXCEPTIONS)))
    i = 1;
  while (true)
    if ((paramThrowable instanceof IOException))
    {
      if ((i != 0) && ((paramThrowable instanceof JsonMappingException)))
        break;
      throw ((IOException)paramThrowable);
      i = 0;
      continue;
    }
    else
    {
      if ((i != 0) || (!(paramThrowable instanceof RuntimeException)))
        break;
      throw ((RuntimeException)paramThrowable);
    }
  throw JsonMappingException.wrapWithPath(paramThrowable, paramObject, paramString);
}