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


Java Feature类代码示例

本文整理汇总了Java中org.codehaus.jackson.map.SerializationConfig.Feature的典型用法代码示例。如果您正苦于以下问题:Java Feature类的具体用法?Java Feature怎么用?Java Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Feature类属于org.codehaus.jackson.map.SerializationConfig包,在下文中一共展示了Feature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: formatBean

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
@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));
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:25,代码来源:JsonResourceFormatter.java

示例2: _constructWriter

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:17,代码来源:BeanSerializerFactory.java

示例3: serialize

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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));
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:19,代码来源:JodaSerializers.java

示例4: serialize

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:gbif,项目名称:gbif-api,代码行数:19,代码来源:TermMapListSerializer.java

示例5: wrapAndThrow

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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);
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:17,代码来源:SerializerBase.java

示例6: createObjectMapper

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
private ObjectMapper createObjectMapper() {
  ObjectMapper mapper = new ObjectMapper();
  mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());
  mapper.setSerializationInclusion(Inclusion.NON_NULL);
  mapper.configure(Feature.CLOSE_CLOSEABLE, false);
  return mapper;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:8,代码来源:FileSystemTimelineWriter.java

示例7: getObjectMapper

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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;
}
 
开发者ID:SMASH-Lab,项目名称:SEE-HLA-Starter-Kit,代码行数:9,代码来源:ConfigurationFactory.java

示例8: createDefaultMapper

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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;
}
 
开发者ID:tommyschnabel,项目名称:SimpleJavaServer,代码行数:9,代码来源:DefaultObjectMapperProvider.java

示例9: createObjectMapper

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:9,代码来源:FileSystemTimelineWriter.java

示例10: createMapper

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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;
	
}
 
开发者ID:harvard-library,项目名称:ecru,代码行数:12,代码来源:RestObjectMapperProvider.java

示例11: JacksonMsgConverter

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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);
}
 
开发者ID:detectiveframework,项目名称:detective,代码行数:9,代码来源:JacksonMsgConverter.java

示例12: serialize

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:ArraySerializers.java

示例13: serializeWithType

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:15,代码来源:ArraySerializers.java

示例14: resolve

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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);
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:11,代码来源:JsonValueSerializer.java

示例15: wrapAndThrow

import org.codehaus.jackson.map.SerializationConfig.Feature; //导入依赖的package包/类
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);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:28,代码来源:SerializerBase.java


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