Refine search
/** * Convenience method for constructing {@link ObjectWriter} * with default settings. */ public ObjectWriter writer() { return _newWriter(getSerializationConfig()); }
/** * 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); }
/** * 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); }
/** * @deprecated Since 2.5, use {@link #writerFor(JavaType)} instead */ @Deprecated public ObjectWriter writerWithType(JavaType rootType) { return _newWriter(getSerializationConfig(), rootType, /*PrettyPrinter*/null); }
/** * @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); }
/** * @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); }
/** * 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); }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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); }
/** * 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)); }
/** * 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()); }
/** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified filter provider. */ public ObjectWriter writer(FilterProvider filterProvider) { return _newWriter(getSerializationConfig().withFilters(filterProvider)); }
/** * 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); }
/** * 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); }