• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Feature类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: processViews

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


示例17: sortBeanProperties

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


示例18: serialize

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


示例19: serializeWithType

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


示例20: _serializeValue

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ShortConverter类代码示例发布时间:2022-05-21
下一篇:
Java PNGMetadata类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap