本文整理了Java中com.fasterxml.jackson.databind.ObjectMapper._newWriter()
方法的一些代码示例,展示了ObjectMapper._newWriter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectMapper._newWriter()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.ObjectMapper
类名称:ObjectMapper
方法名:_newWriter
[英]Factory method sub-classes must override, to produce ObjectWriterinstances of proper sub-type
[中]工厂方法子类必须重写,以生成正确子类型的ObjectWriterInstance
代码示例来源:origin: redisson/redisson
/**
* Convenience method for constructing {@link ObjectWriter}
* with default settings.
*/
public ObjectWriter writer() {
return _newWriter(getSerializationConfig());
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified pretty printer for indentation
* (or if null, no pretty printer)
*/
public ObjectWriter writer(PrettyPrinter pp) {
if (pp == null) { // need to use a marker to indicate explicit disabling of pp
pp = ObjectWriter.NULL_PRETTY_PRINTER;
}
return _newWriter(getSerializationConfig(), /*root type*/ null, pp);
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified root type, instead of actual
* runtime type of value. Type must be a super-type of runtime type.
*<p>
* Main reason for using this method is performance, as writer is able
* to pre-fetch serializer to use before write, and if writer is used
* more than once this avoids addition per-value serializer lookups.
*
* @since 2.5
*/
public ObjectWriter writerFor(JavaType rootType) {
return _newWriter(getSerializationConfig(), rootType, /*PrettyPrinter*/null);
}
代码示例来源:origin: redisson/redisson
/**
* @deprecated Since 2.5, use {@link #writerFor(JavaType)} instead
*/
@Deprecated
public ObjectWriter writerWithType(JavaType rootType) {
return _newWriter(getSerializationConfig(), rootType, /*PrettyPrinter*/null);
}
代码示例来源:origin: redisson/redisson
/**
* @deprecated Since 2.5, use {@link #writerFor(TypeReference)} instead
*/
@Deprecated
public ObjectWriter writerWithType(TypeReference<?> rootType) {
return _newWriter(getSerializationConfig(),
// 15-Mar-2013, tatu: Important! Indicate that static typing is needed:
((rootType == null) ? null : _typeFactory.constructType(rootType)),
/*PrettyPrinter*/null);
}
代码示例来源:origin: redisson/redisson
/**
* @deprecated Since 2.5, use {@link #writerFor(Class)} instead
*/
@Deprecated
public ObjectWriter writerWithType(Class<?> rootType) {
return _newWriter(getSerializationConfig(),
// 15-Mar-2013, tatu: Important! Indicate that static typing is needed:
((rootType == null) ? null :_typeFactory.constructType(rootType)),
/*PrettyPrinter*/null);
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified root type, instead of actual
* runtime type of value. Type must be a super-type of runtime type.
*<p>
* Main reason for using this method is performance, as writer is able
* to pre-fetch serializer to use before write, and if writer is used
* more than once this avoids addition per-value serializer lookups.
*
* @since 2.5
*/
public ObjectWriter writerFor(TypeReference<?> rootType) {
return _newWriter(getSerializationConfig(),
((rootType == null) ? null : _typeFactory.constructType(rootType)),
/*PrettyPrinter*/null);
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified root type, instead of actual
* runtime type of value. Type must be a super-type of runtime type.
*<p>
* Main reason for using this method is performance, as writer is able
* to pre-fetch serializer to use before write, and if writer is used
* more than once this avoids addition per-value serializer lookups.
*
* @since 2.5
*/
public ObjectWriter writerFor(Class<?> rootType) {
return _newWriter(getSerializationConfig(),
((rootType == null) ? null :_typeFactory.constructType(rootType)),
/*PrettyPrinter*/null);
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} with
* specified feature enabled (compared to settings that this
* mapper instance has).
*/
public ObjectWriter writer(SerializationFeature feature) {
return _newWriter(getSerializationConfig().with(feature));
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified JSON View (filter).
*/
public ObjectWriter writerWithView(Class<?> serializationView) {
return _newWriter(getSerializationConfig().withView(serializationView));
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* pass specific schema object to {@link JsonGenerator} used for
* writing content.
*
* @param schema Schema to pass to generator
*/
public ObjectWriter writer(FormatSchema schema) {
_verifySchemaType(schema);
return _newWriter(getSerializationConfig(), schema);
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} with
* specified features enabled (compared to settings that this
* mapper instance has).
*/
public ObjectWriter writer(SerializationFeature first,
SerializationFeature... other) {
return _newWriter(getSerializationConfig().with(first, other));
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified {@link DateFormat}; or, if
* null passed, using timestamp (64-bit number.
*/
public ObjectWriter writer(DateFormat df) {
return _newWriter(getSerializationConfig().with(df));
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* use specified Base64 encoding variant for Base64-encoded binary data.
*
* @since 2.1
*/
public ObjectWriter writer(Base64Variant defaultBase64) {
return _newWriter(getSerializationConfig().with(defaultBase64));
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectReader} that will
* use specified character escaping details for output.
*
* @since 2.3
*/
public ObjectWriter writer(CharacterEscapes escapes) {
return _newWriter(getSerializationConfig()).with(escapes);
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* use specified default attributes.
*
* @since 2.3
*/
public ObjectWriter writer(ContextAttributes attrs) {
return _newWriter(getSerializationConfig().with(attrs));
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using the default pretty printer for indentation
*/
public ObjectWriter writerWithDefaultPrettyPrinter() {
SerializationConfig config = getSerializationConfig();
return _newWriter(config,
/*root type*/ null, config.getDefaultPrettyPrinter());
}
代码示例来源:origin: redisson/redisson
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified filter provider.
*/
public ObjectWriter writer(FilterProvider filterProvider) {
return _newWriter(getSerializationConfig().withFilters(filterProvider));
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified pretty printer for indentation
* (or if null, no pretty printer)
*/
@SuppressWarnings("unchecked")
public <W extends ObjectWriter> W writer(PrettyPrinter pp) {
if (pp == null) { // need to use a marker to indicate explicit disabling of pp
pp = ObjectWriter.NULL_PRETTY_PRINTER;
}
return (W) _newWriter(getSerializationConfig(), /*root type*/ null, pp);
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
/**
* Factory method for constructing {@link ObjectWriter} that will
* serialize objects using specified pretty printer for indentation
* (or if null, no pretty printer)
*/
public ObjectWriter writer(PrettyPrinter pp) {
if (pp == null) { // need to use a marker to indicate explicit disabling of pp
pp = ObjectWriter.NULL_PRETTY_PRINTER;
}
return _newWriter(getSerializationConfig(), /*root type*/ null, pp);
}
内容来源于网络,如有侵权,请联系作者删除!