diff options
author | Tatu Saloranta <tatu.saloranta@iki.fi> | 2014-11-20 22:48:10 -0800 |
---|---|---|
committer | Tatu Saloranta <tatu.saloranta@iki.fi> | 2014-11-20 22:48:10 -0800 |
commit | 5a497889285b735e55eec1cb7ce985a1002fac47 (patch) | |
tree | 5c581d82d3e8f198224b808fbd7b6e55953f3ebd /src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java | |
parent | 04fdb6e69ebd56d69ee6e7879cd06407c0d6c849 (diff) | |
download | jackson-databind-5a497889285b735e55eec1cb7ce985a1002fac47.tar.gz |
Naming improvements
Diffstat (limited to 'src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java')
-rw-r--r-- | src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java b/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java index 5a11ee8b8..35489baa0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java @@ -404,8 +404,7 @@ public class ObjectWriter * Note that method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ - - public ObjectWriter withSchema(FormatSchema schema) { + public ObjectWriter with(FormatSchema schema) { if (_schema == schema) { return this; } @@ -415,14 +414,24 @@ public class ObjectWriter } /** + * @deprecated Since 2.5 use {@link #with(FormatSchema)} instead + */ + @Deprecated + public ObjectWriter withSchema(FormatSchema schema) { + return with(schema); + } + + /** * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. *<p> * Note that method does NOT change state of this reader, but * rather construct and returns a newly configured instance. + * + * @since 2.5 */ - public ObjectWriter withType(JavaType rootType) + public ObjectWriter forType(JavaType rootType) { JsonSerializer<Object> rootSer; if (rootType == null || rootType.hasRawClass(Object.class)) { @@ -441,16 +450,42 @@ public class ObjectWriter * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. + * + * @since 2.5 */ - public ObjectWriter withType(Class<?> rootType) { + public ObjectWriter forType(Class<?> rootType) { if (rootType == Object.class) { - return withType((JavaType) null); + return forType((JavaType) null); } - return withType(_config.constructType(rootType)); + return forType(_config.constructType(rootType)); } + public ObjectWriter forType(TypeReference<?> rootType) { + return forType(_config.getTypeFactory().constructType(rootType.getType())); + } + + /** + * @deprecated since 2.5 Use {@link #forType(JavaType)} instead + */ + @Deprecated // since 2.5 + public ObjectWriter withType(JavaType rootType) { + return forType(rootType); + } + + /** + * @deprecated since 2.5 Use {@link #forType(Class)} instead + */ + @Deprecated // since 2.5 + public ObjectWriter withType(Class<?> rootType) { + return forType(rootType); + } + + /** + * @deprecated since 2.5 Use {@link #forType(TypeReference)} instead + */ + @Deprecated // since 2.5 public ObjectWriter withType(TypeReference<?> rootType) { - return withType(_config.getTypeFactory().constructType(rootType.getType())); + return forType(rootType); } /** |