本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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\":"));
}
示例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();
}
示例7: VOSerializerProvider
import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
protected VOSerializerProvider(SerializerProvider src, SerializationConfig config, SerializerFactory f) {
super(src, config, f);
}
示例8: createInstance
import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public VOSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) {
return new VOSerializerProvider(this, config, jsf);
}
示例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);
}
示例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);
}
示例12: CustomNullStringSerializerProvider
import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
public CustomNullStringSerializerProvider(CustomNullStringSerializerProvider provider, SerializationConfig config, SerializerFactory jsf) {
super(provider, config, jsf);
}
示例13: createInstance
import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public CustomNullStringSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) {
return new CustomNullStringSerializerProvider(this, config, jsf);
}
示例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);
}
示例15: createInstance
import com.fasterxml.jackson.databind.ser.SerializerFactory; //导入依赖的package包/类
@Override
public InjectableSerializerProvider createInstance(
final SerializationConfig config, final SerializerFactory factory) {
return this;
}