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


Java SerializerFactory类代码示例

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


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

示例1: renderWithCustomSerializerLocatedByFactory

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Test
public void renderWithCustomSerializerLocatedByFactory() throws Exception {
	SerializerFactory factory = new DelegatingSerializerFactory(null);
	ObjectMapper mapper = new ObjectMapper();
	mapper.setSerializerFactory(factory);
	view.setObjectMapper(mapper);

	Object bean = new TestBeanSimple();
	Map<String, Object> model = new HashMap<String, Object>();
	model.put("foo", bean);
	model.put("bar", new TestChildBean());

	view.render(model, request, response);

	String result = response.getContentAsString();
	assertTrue(result.length() > 0);
	assertTrue(result.contains("\"foo\":{\"testBeanSimple\":\"custom\"}"));

	validateResult();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:21,代码来源:MappingJackson2JsonViewTests.java

示例2: renderWithCustomSerializerLocatedByFactory

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Test
public void renderWithCustomSerializerLocatedByFactory() throws Exception {
	SerializerFactory factory = new DelegatingSerializerFactory(null);
	XmlMapper mapper = new XmlMapper();
	mapper.setSerializerFactory(factory);
	view.setObjectMapper(mapper);

	Object bean = new TestBeanSimple();
	Map<String, Object> model = new HashMap<String, Object>();
	model.put("foo", bean);

	view.render(model, request, response);

	String result = response.getContentAsString();
	assertTrue(result.length() > 0);
	assertTrue(result.contains("custom</testBeanSimple>"));

	validateResult();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:MappingJackson2XmlViewTests.java

示例3: renderWithCustomSerializerLocatedByFactory

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Test
public void renderWithCustomSerializerLocatedByFactory() throws Exception {

	SerializerFactory factory = new DelegatingSerializerFactory(null);
	ObjectMapper mapper = new ObjectMapper();
	mapper.setSerializerFactory(factory);
	view.setObjectMapper(mapper);

	Object bean = new TestBeanSimple();
	Map<String, Object> model = new HashMap<String, Object>();
	model.put("foo", bean);
	model.put("bar", new TestChildBean());

	view.render(model, request, response);

	String result = response.getContentAsString();
	assertTrue(result.length() > 0);
	assertTrue(result.contains("\"foo\":{\"testBeanSimple\":\"custom\"}"));

	validateResult();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:22,代码来源:MappingJackson2JsonViewTests.java

示例4: serializerFactory

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Test
public void serializerFactory() throws Exception {
	DataSource dataSource = new DataSource();
	SerializerFactory factory = BeanSerializerFactory.instance
			.withSerializerModifier(new GenericSerializerModifier());
	ObjectMapper mapper = new ObjectMapper();
	mapper.setSerializerFactory(factory);
	String value = mapper.writeValueAsString(dataSource);
	assertThat(value.contains("\"url\":")).isTrue();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:DataSourceJsonSerializationTests.java

示例5: serializerFactory

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Test
public void serializerFactory() throws Exception {
	DataSource dataSource = new DataSource();
	SerializerFactory factory = BeanSerializerFactory.instance
			.withSerializerModifier(new GenericSerializerModifier());
	ObjectMapper mapper = new ObjectMapper();
	mapper.setSerializerFactory(factory);
	String value = mapper.writeValueAsString(dataSource);
	assertTrue(value.contains("\"url\":"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:DataSourceJsonSerializationTests.java

示例6: SerializerProvider

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
public SerializerProvider(SerializerProvider paramSerializerProvider, SerializationConfig paramSerializationConfig, SerializerFactory paramSerializerFactory)
{
  if (paramSerializationConfig == null)
    throw new NullPointerException();
  this._serializerFactory = paramSerializerFactory;
  this._config = paramSerializationConfig;
  this._serializerCache = paramSerializerProvider._serializerCache;
  this._unknownTypeSerializer = paramSerializerProvider._unknownTypeSerializer;
  this._keySerializer = paramSerializerProvider._keySerializer;
  this._nullValueSerializer = paramSerializerProvider._nullValueSerializer;
  this._nullKeySerializer = paramSerializerProvider._nullKeySerializer;
  this._rootNames = paramSerializerProvider._rootNames;
  this._knownSerializers = this._serializerCache.getReadOnlyLookupMap();
  this._serializationView = paramSerializationConfig.getActiveView();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:16,代码来源:SerializerProvider.java

示例7: VOSerializerProvider

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
protected VOSerializerProvider(SerializerProvider src, SerializationConfig config, SerializerFactory f) {
	super(src, config, f);
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:4,代码来源:VOSerializerProvider.java

示例8: createInstance

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public VOSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) {
	return new VOSerializerProvider(this, config, jsf);
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:5,代码来源:VOSerializerProvider.java

示例9: applySerializationModifier

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
/**
 * Ensure only bindable and non-cyclic bean properties are reported.
 * @param mapper the object mapper
 */
private void applySerializationModifier(ObjectMapper mapper) {
	SerializerFactory factory = BeanSerializerFactory.instance
			.withSerializerModifier(new GenericSerializerModifier());
	mapper.setSerializerFactory(factory);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:ConfigurationPropertiesReportEndpoint.java

示例10: withConfig

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public SerializerFactory withConfig(SerializerFactoryConfig config) {
	return new HibernateBeanSerializerFactory(config);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:5,代码来源:HibernateBeanSerializerFactory.java

示例11: createInstance

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public DefaultSerializerProvider createInstance(SerializationConfig cfg, SerializerFactory jsf) {
    return new CustomSerializerProvider(this, cfg, jsf);
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:GridJettyObjectMapper.java

示例12: CustomNullStringSerializerProvider

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
public CustomNullStringSerializerProvider(CustomNullStringSerializerProvider provider, SerializationConfig config, SerializerFactory jsf) {
  super(provider, config, jsf);
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:4,代码来源:CustomNullStringSerializerProvider.java

示例13: createInstance

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public CustomNullStringSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) {
  return new CustomNullStringSerializerProvider(this, config, jsf);
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:5,代码来源:CustomNullStringSerializerProvider.java

示例14: InjectableSerializerProvider

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
public InjectableSerializerProvider(
        final SerializerProvider src, final SerializationConfig config, final SerializerFactory factory) {

    super(src, config, factory);
}
 
开发者ID:ashank,项目名称:Office-365-SDK-for-Android,代码行数:6,代码来源:InjectableSerializerProvider.java

示例15: createInstance

import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public InjectableSerializerProvider createInstance(
        final SerializationConfig config, final SerializerFactory factory) {

    return this;
}
 
开发者ID:ashank,项目名称:Office-365-SDK-for-Android,代码行数:7,代码来源:InjectableSerializerProvider.java


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