From e433f594737f6fc1b19f691a51834ad8500ab0ad Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 8 Aug 2017 20:58:33 -0700 Subject: [PATCH] Yet more deprecation removal for 3.0 --- .../databind/AbstractTypeResolver.java | 14 - .../databind/DeserializationContext.java | 58 +--- .../jackson/databind/JsonDeserializer.java | 43 +-- .../databind/JsonMappingException.java | 61 +--- .../jackson/databind/JsonSerializer.java | 21 +- .../jackson/databind/ObjectMapper.java | 152 +-------- .../jackson/databind/ObjectReader.java | 38 +-- .../jackson/databind/ObjectWriter.java | 61 +--- .../jackson/databind/PropertyMetadata.java | 23 -- .../databind/PropertyNamingStrategy.java | 53 +-- .../jackson/databind/SerializationConfig.java | 60 +--- .../databind/SerializationFeature.java | 36 -- .../jackson/databind/SerializerProvider.java | 54 +-- .../databind/annotation/JsonSerialize.java | 101 +----- .../databind/cfg/MapperConfigBase.java | 19 -- .../databind/deser/BeanDeserializerBase.java | 12 +- .../deser/DeserializationProblemHandler.java | 22 +- .../databind/deser/SettableAnyProperty.java | 11 - .../deser/UnresolvedForwardReference.java | 29 +- .../databind/deser/impl/BeanPropertyMap.java | 30 +- .../databind/deser/impl/CreatorCollector.java | 18 +- .../deser/impl/PropertyBasedCreator.java | 9 - .../databind/deser/std/EnumDeserializer.java | 35 +- .../deser/std/EnumMapDeserializer.java | 12 +- .../databind/deser/std/StdDeserializer.java | 10 +- .../deser/std/StdValueInstantiator.java | 40 --- .../exc/IgnoredPropertyException.java | 16 - .../databind/exc/InvalidFormatException.java | 34 +- .../exc/MismatchedInputException.java | 8 - .../exc/PropertyBindingException.java | 16 - .../exc/UnrecognizedPropertyException.java | 11 - .../jackson/databind/ext/DOMSerializer.java | 7 - .../databind/introspect/Annotated.java | 29 -- .../databind/introspect/AnnotatedClass.java | 66 ---- .../introspect/AnnotatedConstructor.java | 10 - .../databind/introspect/AnnotatedField.java | 6 - .../databind/introspect/AnnotatedMember.java | 25 -- .../databind/introspect/AnnotatedMethod.java | 16 - .../introspect/AnnotatedParameter.java | 11 +- .../introspect/AnnotatedWithParams.java | 13 - .../introspect/BasicBeanDescription.java | 61 ---- .../JacksonAnnotationIntrospector.java | 27 -- .../databind/jsonschema/JsonSchema.java | 96 ------ .../jsonschema/JsonSerializableSchema.java | 70 ---- .../databind/jsonschema/SchemaAware.java | 34 -- .../databind/jsonschema/package-info.java | 5 - .../databind/jsontype/SubtypeResolver.java | 72 +--- .../databind/jsontype/TypeSerializer.java | 158 --------- .../module/SimpleAbstractTypeResolver.java | 7 - .../jackson/databind/node/ArrayNode.java | 6 - .../jackson/databind/node/ObjectNode.java | 58 +--- .../databind/ser/BasicSerializerFactory.java | 4 - .../databind/ser/BeanPropertyFilter.java | 94 ----- .../databind/ser/BeanPropertyWriter.java | 102 +----- .../databind/ser/ContainerSerializer.java | 44 +-- .../ser/DefaultSerializerProvider.java | 29 -- .../jackson/databind/ser/FilterProvider.java | 30 +- .../jackson/databind/ser/PropertyFilter.java | 29 +- .../jackson/databind/ser/PropertyWriter.java | 15 +- .../databind/ser/impl/FailingSerializer.java | 10 +- .../ser/impl/SimpleBeanPropertyFilter.java | 96 +----- .../ser/impl/SimpleFilterProvider.java | 40 --- .../ser/impl/StringArraySerializer.java | 6 - .../databind/ser/impl/UnknownSerializer.java | 6 - .../ser/std/AsArraySerializerBase.java | 22 -- .../databind/ser/std/BeanSerializerBase.java | 47 +-- .../databind/ser/std/BooleanSerializer.java | 8 - .../databind/ser/std/ByteArraySerializer.java | 11 - .../databind/ser/std/ClassSerializer.java | 8 - .../ser/std/DateTimeSerializerBase.java | 7 - .../databind/ser/std/EnumSerializer.java | 22 -- .../databind/ser/std/FileSerializer.java | 7 - .../databind/ser/std/JsonValueSerializer.java | 120 +------ .../jackson/databind/ser/std/MapProperty.java | 8 - .../databind/ser/std/MapSerializer.java | 63 +--- .../databind/ser/std/NullSerializer.java | 8 +- .../databind/ser/std/NumberSerializer.java | 6 - .../databind/ser/std/NumberSerializers.java | 6 - .../databind/ser/std/RawSerializer.java | 10 +- .../databind/ser/std/SqlTimeSerializer.java | 6 - .../ser/std/StaticListSerializerBase.java | 6 - .../databind/ser/std/StdArraySerializers.java | 50 +-- .../ser/std/StdDelegatingSerializer.java | 30 +- .../databind/ser/std/StdJdkSerializers.java | 22 +- .../databind/ser/std/StdScalarSerializer.java | 9 - .../databind/ser/std/StdSerializer.java | 48 +-- .../databind/ser/std/StringSerializer.java | 7 - .../databind/ser/std/ToStringSerializer.java | 12 - .../ser/std/TokenBufferSerializer.java | 10 - .../databind/util/ISO8601DateFormat.java | 54 --- .../jackson/databind/util/ISO8601Utils.java | 320 ------------------ .../jackson/databind/ObjectReaderTest.java | 15 - .../deser/jdk/MapDeserializationTest.java | 2 +- .../deser/jdk/UntypedDeserializationTest.java | 2 +- .../databind/exc/BasicExceptionTest.java | 17 - .../databind/jsonschema/NewSchemaTest.java | 5 - .../jsonschema/TestGenerateJsonSchema.java | 250 -------------- .../jsonschema/TestReadJsonSchema.java | 62 ---- .../databind/module/SimpleModuleTest.java | 38 +-- .../databind/ser/TestKeySerializers.java | 2 - .../ser/filter/JsonInclude1327Test.java | 4 +- .../ser/filter/JsonIncludeOverrideTest.java | 2 +- .../databind/ser/filter/JsonIncludeTest.java | 3 +- .../databind/ser/filter/TestMapFiltering.java | 23 +- .../databind/util/ISO8601DateFormatTest.java | 65 ---- .../databind/util/ISO8601UtilsTest.java | 201 ----------- 106 files changed, 100 insertions(+), 3907 deletions(-) delete mode 100644 src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSchema.java delete mode 100644 src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java delete mode 100644 src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java delete mode 100644 src/main/java/com/fasterxml/jackson/databind/jsonschema/package-info.java delete mode 100644 src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyFilter.java delete mode 100644 src/main/java/com/fasterxml/jackson/databind/util/ISO8601DateFormat.java delete mode 100644 src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java delete mode 100644 src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java delete mode 100644 src/test/java/com/fasterxml/jackson/databind/jsonschema/TestReadJsonSchema.java delete mode 100644 src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java delete mode 100644 src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java diff --git a/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java b/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java index 587c29fee7..cbb3b13dcd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java +++ b/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java @@ -30,18 +30,6 @@ public JavaType findTypeMapping(DeserializationConfig config, JavaType type) { return null; } - /** - * Older variant of {@link #resolveAbstractType(DeserializationConfig, BeanDescription)}; - * obsoleted in 2.7 - * - * @deprecated since 2.8 (may be removed from 2.9 or later) - */ - @Deprecated - public JavaType resolveAbstractType(DeserializationConfig config, - JavaType type) { - return null; - } - /** * Method called to try to resolve an abstract type into * concrete type (usually for purposes of deserializing), @@ -56,8 +44,6 @@ public JavaType resolveAbstractType(DeserializationConfig config, * @return Resolved concrete type (which should retain generic * type parameters of input type, if any), if resolution succeeds; * null if resolver does not know how to resolve given type - * - * @since 2.7 */ public JavaType resolveAbstractType(DeserializationConfig config, BeanDescription typeDesc) { diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java index 05903c22fd..b544740e38 100644 --- a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java +++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java @@ -51,7 +51,7 @@ public abstract class DeserializationContext extends DatabindContext implements java.io.Serializable { - private static final long serialVersionUID = 1L; // 2.6 + private static final long serialVersionUID = 3L; /* /********************************************************** @@ -1351,49 +1351,6 @@ public T reportTrailingTokens(Class targetType, )); } - @Deprecated // since 2.9 - public void reportWrongTokenException(JsonParser p, - JsonToken expToken, String msg, Object... msgArgs) - throws JsonMappingException - { - msg = _format(msg, msgArgs); - throw wrongTokenException(p, expToken, msg); - } - - /** - * Helper method for reporting a problem with unhandled unknown property. - * - * @param instanceOrClass Either value being populated (if one has been - * instantiated), or Class that indicates type that would be (or - * have been) instantiated - * @param deser Deserializer that had the problem, if called by deserializer - * (or on behalf of one) - * - * @deprecated Since 2.8 call {@link #handleUnknownProperty} instead - */ - @Deprecated - public void reportUnknownProperty(Object instanceOrClass, String fieldName, - JsonDeserializer deser) - throws JsonMappingException - { - if (isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)) { - // Do we know properties that are expected instead? - Collection propIds = (deser == null) ? null : deser.getKnownPropertyNames(); - throw UnrecognizedPropertyException.from(_parser, - instanceOrClass, fieldName, propIds); - } - } - - /** - * @since 2.8 - * - * @deprecated Since 2.9: not clear this ever occurs - */ - @Deprecated // since 2.9 - public void reportMissingContent(String msg, Object... msgArgs) throws JsonMappingException { - throw MismatchedInputException.from(getParser(), (JavaType) null, "No content to map due to end-of-input"); - } - /* /********************************************************** /* Methods for problem reporting, in cases where recovery @@ -1405,8 +1362,6 @@ public void reportMissingContent(String msg, Object... msgArgs) throws JsonMappi * Helper method called to indicate problem in POJO (serialization) definitions or settings * regarding specific Java type, unrelated to actual JSON content to map. * Default behavior is to construct and throw a {@link JsonMappingException}. - * - * @since 2.9 */ public T reportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs) throws JsonMappingException { @@ -1420,8 +1375,6 @@ public T reportBadTypeDefinition(BeanDescription bean, * Helper method called to indicate problem in POJO (serialization) definitions or settings * regarding specific property (of a type), unrelated to actual JSON content to map. * Default behavior is to construct and throw a {@link JsonMappingException}. - * - * @since 2.9 */ public T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String msg, Object... msgArgs) throws JsonMappingException { @@ -1493,13 +1446,6 @@ public JsonMappingException wrongTokenException(JsonParser p, Class targetTyp msg = _colonConcat(msg, extra); return MismatchedInputException.from(p, targetType, msg); } - - @Deprecated // since 2.9 - public JsonMappingException wrongTokenException(JsonParser p, JsonToken expToken, - String msg) - { - return wrongTokenException(p, (JavaType) null, expToken, msg); - } /** * Helper method for constructing exception to indicate that given JSON @@ -1527,8 +1473,6 @@ public JsonMappingException weirdKeyException(Class keyClass, String keyValue * @param value String value from input being deserialized * @param instClass Type that String should be deserialized into * @param msg Message that describes specific problem - * - * @since 2.1 */ public JsonMappingException weirdStringException(String value, Class instClass, String msg) { diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java index 469055f174..6577620ebd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java @@ -44,7 +44,7 @@ * contextualization. */ public abstract class JsonDeserializer - implements NullValueProvider // since 2.9 + implements NullValueProvider { /* /********************************************************** @@ -179,8 +179,6 @@ public JsonDeserializer unwrappingDeserializer(NameTransformer unwrapper) { * delegate anything; or it does not want any changes), should either * throw {@link UnsupportedOperationException} (if operation does not * make sense or is not allowed); or return this deserializer as is. - * - * @since 2.1 */ public JsonDeserializer replaceDelegatee(JsonDeserializer delegatee) { throw new UnsupportedOperationException(); @@ -202,8 +200,6 @@ public JsonDeserializer replaceDelegatee(JsonDeserializer delegatee) { * Default implementation will return null, which means almost same * same as returning Object.class would; that is, that * nothing is known about handled type. - *

- * @since 2.3 */ public Class handledType() { return null; } @@ -231,8 +227,6 @@ public JsonDeserializer replaceDelegatee(JsonDeserializer delegatee) { * * @return Deserializer this deserializer delegates calls to, if null; * null otherwise. - * - * @since 2.1 */ public JsonDeserializer getDelegatee() { return null; @@ -247,8 +241,6 @@ public JsonDeserializer getDelegatee() { * This is only to be used for error reporting and diagnostics * purposes (most commonly, to accompany "unknown property" * exception). - * - * @since 2.0 */ public Collection getKnownPropertyNames() { return null; @@ -272,13 +264,10 @@ public Collection getKnownPropertyNames() { * be handled. *

* Default implementation simply returns null. - * - * @since 2.6 Added to replace earlier no-arguments variant */ @Override public T getNullValue(DeserializationContext ctxt) throws JsonMappingException { - // Change the direction in 2.7 - return getNullValue(); + return null; } /** @@ -299,8 +288,6 @@ public AccessPattern getNullAccessPattern() { * {@link #getEmptyValue(DeserializationContext)}, to check whether it needs * to be called just once (static values), or each time empty value is * needed. - * - * @since 2.9 */ public AccessPattern getEmptyAccessPattern() { return AccessPattern.DYNAMIC; @@ -327,8 +314,6 @@ public AccessPattern getEmptyAccessPattern() { *

* Default implementation simply calls {@link #getNullValue} and * returns value. - * - * @since 2.6 Added to replace earlier no-arguments variant */ public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingException { return getNullValue(ctxt); @@ -349,16 +334,12 @@ public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingExcep * @return ObjectIdReader used for resolving possible Object Identifier * value, instead of full value serialization, if deserializer can do that; * null if no Object Id is expected. - * - * @since 2.0 */ public ObjectIdReader getObjectIdReader() { return null; } /** * Method needed by {@link BeanDeserializerFactory} to properly link * managed- and back-reference pairs. - * - * @since 2.2 (was moved out of BeanDeserializerBase) */ public SettableBeanProperty findBackReference(String refName) { @@ -382,31 +363,11 @@ public SettableBeanProperty findBackReference(String refName) *

* Default implementation returns null to allow explicit per-type * or per-property attempts. - * - * @since 2.9 */ public Boolean supportsUpdate(DeserializationConfig config) { return null; } - /* - /********************************************************** - /* Deprecated methods - /********************************************************** - */ - - /** - * @deprecated Since 2.6 Use overloaded variant that takes context argument - */ - @Deprecated - public T getNullValue() { return null; } - - /** - * @deprecated Since 2.6 Use overloaded variant that takes context argument - */ - @Deprecated - public Object getEmptyValue() { return getNullValue(); } - /* /********************************************************** /* Helper classes diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java b/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java index 39a2980b14..4f842aea9f 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java @@ -206,33 +206,6 @@ Object writeReplace() { /********************************************************** */ - /** - * @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead - */ - @Deprecated // since 2.7 - public JsonMappingException(String msg) { super(msg); } - - /** - * @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead - */ - @Deprecated // since 2.7 - public JsonMappingException(String msg, Throwable rootCause) { super(msg, rootCause); } - - /** - * @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead - */ - @Deprecated // since 2.7 - public JsonMappingException(String msg, JsonLocation loc) { super(msg, loc); } - - /** - * @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead - */ - @Deprecated // since 2.7 - public JsonMappingException(String msg, JsonLocation loc, Throwable rootCause) { super(msg, loc, rootCause); } - - /** - * @since 2.7 - */ public JsonMappingException(Closeable processor, String msg) { super(msg); _processor = processor; @@ -244,9 +217,6 @@ public JsonMappingException(Closeable processor, String msg) { } } - /** - * @since 2.7 - */ public JsonMappingException(Closeable processor, String msg, Throwable problem) { super(msg, problem); _processor = processor; @@ -255,73 +225,46 @@ public JsonMappingException(Closeable processor, String msg, Throwable problem) } } - /** - * @since 2.7 - */ public JsonMappingException(Closeable processor, String msg, JsonLocation loc) { super(msg, loc); _processor = processor; } - /** - * @since 2.7 - */ public static JsonMappingException from(JsonParser p, String msg) { return new JsonMappingException(p, msg); } - /** - * @since 2.7 - */ public static JsonMappingException from(JsonParser p, String msg, Throwable problem) { return new JsonMappingException(p, msg, problem); } - /** - * @since 2.7 - */ public static JsonMappingException from(JsonGenerator g, String msg) { return new JsonMappingException(g, msg, (Throwable) null); } - /** - * @since 2.7 - */ public static JsonMappingException from(JsonGenerator g, String msg, Throwable problem) { return new JsonMappingException(g, msg, problem); } - /** - * @since 2.7 - */ public static JsonMappingException from(DeserializationContext ctxt, String msg) { return new JsonMappingException(ctxt.getParser(), msg); } - /** - * @since 2.7 - */ public static JsonMappingException from(DeserializationContext ctxt, String msg, Throwable t) { return new JsonMappingException(ctxt.getParser(), msg, t); } - /** - * @since 2.7 - */ public static JsonMappingException from(SerializerProvider ctxt, String msg) { return new JsonMappingException(ctxt.getGenerator(), msg); } - /** - * @since 2.7 - */ public static JsonMappingException from(SerializerProvider ctxt, String msg, Throwable problem) { /* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as * SerializerProvider instance does not currently hold on to generator... */ return new JsonMappingException(ctxt.getGenerator(), msg, problem); } - + /** * Factory method used when "upgrading" an {@link IOException} into * {@link JsonMappingException}: usually only needed to comply with @@ -329,8 +272,6 @@ public static JsonMappingException from(SerializerProvider ctxt, String msg, Thr *

* NOTE: since 2.9 should usually NOT be used on input-side (deserialization) * exceptions; instead use method(s) of InputMismatchException - * - * @since 2.1 */ public static JsonMappingException fromUnexpectedIOE(IOException src) { return new JsonMappingException(null, diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java b/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java index 11c01b24a4..012824ca88 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java @@ -51,7 +51,7 @@ * contextualization. */ public abstract class JsonSerializer - implements JsonFormatVisitable // since 2.1 + implements JsonFormatVisitable { /* /********************************************************** @@ -187,25 +187,6 @@ public void serializeWithType(T value, JsonGenerator gen, SerializerProvider ser * of empty values). *

* Default implementation will consider only null values to be empty. - * - * @deprecated Since 2.5 Use {@link #isEmpty(SerializerProvider, Object)} instead; - * will be removed from 3.0 - */ - @Deprecated - public boolean isEmpty(T value) { - return isEmpty(null, value); - } - - /** - * Method called to check whether given serializable value is - * considered "empty" value (for purposes of suppressing serialization - * of empty values). - *

- * Default implementation will consider only null values to be empty. - *

- * NOTE: replaces {@link #isEmpty(Object)}, which was deprecated in 2.5 - * - * @since 2.5 */ public boolean isEmpty(SerializerProvider provider, T value) { return (value == null); diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java index de43d681c8..40f65b35d8 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java @@ -118,9 +118,9 @@ public class ObjectMapper extends ObjectCodec implements Versioned, - java.io.Serializable // as of 2.1 + java.io.Serializable { - private static final long serialVersionUID = 2L; // as of 2.9 + private static final long serialVersionUID = 3L; /* /********************************************************** @@ -1193,22 +1193,6 @@ public int mixInCount() { return _mixIns.localSize(); } - /** - * @deprecated Since 2.5: replaced by a fluent form of the method; {@link #setMixIns}. - */ - @Deprecated - public void setMixInAnnotations(Map, Class> sourceMixins) { - setMixIns(sourceMixins); - } - - /** - * @deprecated Since 2.5: replaced by a fluent form of the method; {@link #addMixIn(Class, Class)}. - */ - @Deprecated - public final void addMixInAnnotations(Class target, Class mixinSource) { - addMixIn(target, mixinSource); - } - /* /********************************************************** /* Configuration, introspection @@ -1231,8 +1215,6 @@ public VisibilityChecker getVisibilityChecker() { * This default checker is used as the base visibility: * per-class overrides (both via annotations and per-type config overrides) * can further change these settings. - * - * @since 2.6 */ public ObjectMapper setVisibility(VisibilityChecker vc) { _configOverrides.setDefaultVisibility(vc); @@ -1358,14 +1340,6 @@ public ObjectMapper setDefaultPrettyPrinter(PrettyPrinter pp) { return this; } - /** - * @deprecated Since 2.6 use {@link #setVisibility(VisibilityChecker)} instead. - */ - @Deprecated - public void setVisibilityChecker(VisibilityChecker vc) { - setVisibility(vc); - } - /* /********************************************************** /* Configuration: global-default/per-type override settings @@ -1377,30 +1351,15 @@ public void setVisibilityChecker(VisibilityChecker vc) { *

      *  setPropertyInclusion(JsonInclude.Value.construct(incl, incl));
      *
- *

- * NOTE: behavior differs slightly from 2.8, where second argument was - * implied to be JsonInclude.Include.ALWAYS. */ public ObjectMapper setSerializationInclusion(JsonInclude.Include incl) { - setPropertyInclusion(JsonInclude.Value.construct(incl, incl)); - return this; - } - - /** - * @since 2.7 - * @deprecated Since 2.9 use {@link #setDefaultPropertyInclusion} - */ - @Deprecated - public ObjectMapper setPropertyInclusion(JsonInclude.Value incl) { - return setDefaultPropertyInclusion(incl); + return setDefaultPropertyInclusion(JsonInclude.Value.construct(incl, incl)); } /** * Method for setting default POJO property inclusion strategy for serialization, * applied for all properties for which there are no per-type or per-property * overrides (via annotations or config overrides). - * - * @since 2.9 (basically rename of setPropertyInclusion) */ public ObjectMapper setDefaultPropertyInclusion(JsonInclude.Value incl) { _configOverrides.setDefaultInclusion(incl); @@ -1412,8 +1371,6 @@ public ObjectMapper setDefaultPropertyInclusion(JsonInclude.Value incl) { *

      *  setDefaultPropertyInclusion(JsonInclude.Value.construct(incl, incl));
      *
- * - * @since 2.9 (basically rename of setPropertyInclusion) */ public ObjectMapper setDefaultPropertyInclusion(JsonInclude.Include incl) { _configOverrides.setDefaultInclusion(JsonInclude.Value.construct(incl, incl)); @@ -1424,8 +1381,6 @@ public ObjectMapper setDefaultPropertyInclusion(JsonInclude.Include incl) { * Method for setting default Setter configuration, regarding things like * merging, null-handling; used for properties for which there are * no per-type or per-property overrides (via annotations or config overrides). - * - * @since 2.9 */ public ObjectMapper setDefaultSetterInfo(JsonSetter.Value v) { _configOverrides.setDefaultSetterInfo(v); @@ -1748,14 +1703,6 @@ public ObjectMapper setConfig(DeserializationConfig config) { /********************************************************** */ - /** - * @deprecated Since 2.6, use {@link #setFilterProvider} instead (allows chaining) - */ - @Deprecated - public void setFilters(FilterProvider filterProvider) { - _serializationConfig = _serializationConfig.withFilters(filterProvider); - } - /** * Method for configuring this mapper to use specified {@link FilterProvider} for * mapping Filter Ids to actual filter instances. @@ -1764,8 +1711,6 @@ public void setFilters(FilterProvider filterProvider) { * however, sometimes * this method is more convenient. For example, some frameworks only allow configuring * of ObjectMapper instances and not {@link ObjectWriter}s. - * - * @since 2.6 */ public ObjectMapper setFilterProvider(FilterProvider filterProvider) { _serializationConfig = _serializationConfig.withFilters(filterProvider); @@ -1779,8 +1724,6 @@ public ObjectMapper setFilterProvider(FilterProvider filterProvider) { * @param v Base64 variant to use * * @return This mapper, for convenience to allow chaining - * - * @since 2.1 */ public ObjectMapper setBase64Variant(Base64Variant v) { _serializationConfig = _serializationConfig.with(v); @@ -3397,43 +3340,11 @@ public ObjectWriter writer(CharacterEscapes 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)); } - /** - * @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); - } - - /** - * @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(JavaType)} instead - */ - @Deprecated - public ObjectWriter writerWithType(JavaType rootType) { - return _newWriter(getSerializationConfig(), rootType, /*PrettyPrinter*/null); - } - /* /********************************************************** /* Extended Public API: constructing ObjectReaders @@ -3575,40 +3486,11 @@ public ObjectReader reader(Base64Variant defaultBase64) { /** * Factory method for constructing {@link ObjectReader} that will * use specified default attributes. - * - * @since 2.3 */ public ObjectReader reader(ContextAttributes attrs) { return _newReader(getDeserializationConfig().with(attrs)); } - /** - * @deprecated Since 2.5, use {@link #readerFor(JavaType)} instead - */ - @Deprecated - public ObjectReader reader(JavaType type) { - return _newReader(getDeserializationConfig(), type, null, - null, _injectableValues); - } - - /** - * @deprecated Since 2.5, use {@link #readerFor(Class)} instead - */ - @Deprecated - public ObjectReader reader(Class type) { - return _newReader(getDeserializationConfig(), _typeFactory.constructType(type), null, - null, _injectableValues); - } - - /** - * @deprecated Since 2.5, use {@link #readerFor(TypeReference)} instead - */ - @Deprecated - public ObjectReader reader(TypeReference type) { - return _newReader(getDeserializationConfig(), _typeFactory.constructType(type), null, - null, _injectableValues); - } - /* /********************************************************** /* Extended Public API: convenience type conversion @@ -3801,22 +3683,6 @@ public T updateValue(T valueToUpdate, Object overrides) /********************************************************** */ - /** - * Generate Json-schema - * instance for specified class. - * - * @param t The class to generate schema for - * @return Constructed JSON schema. - * - * @deprecated Since 2.6 use external JSON Schema generator (https://github.com/FasterXML/jackson-module-jsonSchema) - * (which under the hood calls {@link #acceptJsonFormatVisitor(JavaType, JsonFormatVisitorWrapper)}) - */ - @Deprecated - public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(Class t) - throws JsonMappingException { - return _serializerProvider(getSerializationConfig()).generateJsonSchema(t); - } - /** * Method for visiting type hierarchy for given type, using specified visitor. *

@@ -3825,8 +3691,6 @@ public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(C * instance for specified type. * * @param type Type to generate schema for (possibly with generic signature) - * - * @since 2.1 */ public void acceptJsonFormatVisitor(Class type, JsonFormatVisitorWrapper visitor) throws JsonMappingException @@ -3843,8 +3707,6 @@ public void acceptJsonFormatVisitor(Class type, JsonFormatVisitorWrapper visi * instance for specified type. * * @param type Type to generate schema for (possibly with generic signature) - * - * @since 2.1 */ public void acceptJsonFormatVisitor(JavaType type, JsonFormatVisitorWrapper visitor) throws JsonMappingException @@ -4131,14 +3993,6 @@ protected JsonToken _initForReading(JsonParser p, JavaType targetType) throws IO return t; } - @Deprecated // since 2.9, use method that takes JavaType too - protected JsonToken _initForReading(JsonParser p) throws IOException { - return _initForReading(p, null); - } - - /** - * @since 2.9 - */ protected final void _verifyNoTrailingTokens(JsonParser p, DeserializationContext ctxt, JavaType bindType) throws IOException diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java b/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java index be8983b2ef..dacaad3acd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java @@ -42,9 +42,9 @@ */ public class ObjectReader extends ObjectCodec - implements Versioned, java.io.Serializable // since 2.1 + implements Versioned, java.io.Serializable { - private static final long serialVersionUID = 2L; // since 2.9 + private static final long serialVersionUID = 3L; private final static JavaType JSON_NODE_TYPE = SimpleType.constructUnsafe(JsonNode.class); @@ -703,45 +703,11 @@ public ObjectReader forType(Class valueType) { *

* Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. - * - * @since 2.5 */ public ObjectReader forType(TypeReference valueTypeRef) { return forType(_config.getTypeFactory().constructType(valueTypeRef.getType())); - } - - /** - * @deprecated since 2.5 Use {@link #forType(JavaType)} instead - */ - @Deprecated - public ObjectReader withType(JavaType valueType) { - return forType(valueType); - } - - /** - * @deprecated since 2.5 Use {@link #forType(Class)} instead - */ - @Deprecated - public ObjectReader withType(Class valueType) { - return forType(_config.constructType(valueType)); - } - - /** - * @deprecated since 2.5 Use {@link #forType(Class)} instead - */ - @Deprecated - public ObjectReader withType(java.lang.reflect.Type valueType) { - return forType(_config.getTypeFactory().constructType(valueType)); } - /** - * @deprecated since 2.5 Use {@link #forType(TypeReference)} instead - */ - @Deprecated - public ObjectReader withType(TypeReference valueTypeRef) { - return forType(_config.getTypeFactory().constructType(valueTypeRef.getType())); - } - /** * Method for constructing a new instance with configuration that * updates passed Object (as root value), instead of constructing diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java b/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java index 5098612467..a915fa1426 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java @@ -421,37 +421,11 @@ public ObjectWriter forType(Class rootType) { * 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 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 forType(rootType); - } - /* /********************************************************** /* Life-cycle, fluent factories, other @@ -545,14 +519,6 @@ public ObjectWriter with(FormatSchema schema) { return _new(_generatorSettings.with(schema), _prefetch); } - /** - * @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 specified * serialization view for serialization (with null basically disables @@ -583,9 +549,6 @@ public ObjectWriter with(Base64Variant b64variant) { return _new(this, _config.with(b64variant)); } - /** - * @since 2.3 - */ public ObjectWriter with(CharacterEscapes escapes) { return _new(_generatorSettings.with(escapes), _prefetch); } @@ -830,31 +793,14 @@ public boolean isEnabled(MapperFeature f) { return _config.isEnabled(f); } - /** - * @since 2.9 - */ - @Deprecated - public boolean isEnabled(JsonParser.Feature f) { - return _generatorFactory.isEnabled(f); - } - - /** - * @since 2.9 - */ public boolean isEnabled(JsonGenerator.Feature f) { return _generatorFactory.isEnabled(f); } - - /** - * @since 2.2 - */ + public SerializationConfig getConfig() { return _config; } - /** - * @since 2.2 - */ public JsonFactory getFactory() { return _generatorFactory; } @@ -868,16 +814,11 @@ public TypeFactory getTypeFactory() { * has pre-fetched serializer to use: pre-fetching improves performance * when writer instances are reused as it avoids a per-call serializer * lookup. - * - * @since 2.2 */ public boolean hasPrefetchedSerializer() { return _prefetch.hasSerializer(); } - /** - * @since 2.3 - */ public ContextAttributes getAttributes() { return _config.getAttributes(); } diff --git a/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java b/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java index 9b57186c2f..6e46aa1c78 100644 --- a/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java +++ b/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java @@ -8,8 +8,6 @@ * properties. Carved out to reduce number of distinct properties that * actual property implementations and place holders need to store; * since instances are immutable, they can be freely shared. - * - * @since 2.3 */ public class PropertyMetadata implements java.io.Serializable @@ -28,8 +26,6 @@ public class PropertyMetadata /** * Helper class used for containing information about expected merge * information for this property, if merging is expected. - * - * @since 2.9 */ public final static class MergeInfo // NOTE: need not be Serializable, not persisted @@ -129,9 +125,6 @@ protected PropertyMetadata(Boolean req, String desc, Integer index, String def, _contentNulls = contentNulls; } - /** - * @since 2.8.8 - */ public static PropertyMetadata construct(Boolean req, String desc, Integer index, String defaultValue) { if ((desc != null) || (index != null) || (defaultValue != null)) { @@ -144,16 +137,6 @@ public static PropertyMetadata construct(Boolean req, String desc, Integer index return req ? STD_REQUIRED : STD_OPTIONAL; } - @Deprecated // since 2.8.8 - public static PropertyMetadata construct(boolean req, String desc, Integer index, - String defaultValue) { - if (desc != null || index != null || defaultValue != null) { - return new PropertyMetadata(req, desc, index, defaultValue, - null, null, null); - } - return req ? STD_REQUIRED : STD_OPTIONAL; - } - /** * Minor optimization: let's canonicalize back to placeholders in cases * where there is no real data to consider @@ -176,17 +159,11 @@ public PropertyMetadata withDescription(String desc) { _mergeInfo, _valueNulls, _contentNulls); } - /** - * @since 2.9 - */ public PropertyMetadata withMergeInfo(MergeInfo mergeInfo) { return new PropertyMetadata(_required, _description, _index, _defaultValue, mergeInfo, _valueNulls, _contentNulls); } - /** - * @since 2.9 - */ public PropertyMetadata withNulls(Nulls valueNulls, Nulls contentNulls) { return new PropertyMetadata(_required, _description, _index, _defaultValue, diff --git a/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategy.java b/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategy.java index e3024264a8..8426cf5a4c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategy.java +++ b/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategy.java @@ -27,24 +27,20 @@ * characters). */ @SuppressWarnings("serial") -public class PropertyNamingStrategy // NOTE: was abstract until 2.7 +public class PropertyNamingStrategy implements java.io.Serializable { /** * Naming convention used in languages like C, where words are in lower-case * letters, separated by underscores. * See {@link SnakeCaseStrategy} for details. - * - * @since 2.7 (was formerly called {@link #CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES}) */ public static final PropertyNamingStrategy SNAKE_CASE = new SnakeCaseStrategy(); /** * Naming convention used in languages like Pascal, where words are capitalized * and no separator is used between words. - * See {@link PascalCaseStrategy} for details. - * - * @since 2.7 (was formerly called {@link #PASCAL_CASE_TO_CAMEL_CASE}) + * See {@link UpperCamelCaseStrategy} for details. */ public static final PropertyNamingStrategy UPPER_CAMEL_CASE = new UpperCamelCaseStrategy(); @@ -53,8 +49,6 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7 * and no separator is used between words. Since this is the native Java naming convention, * naming strategy will not do any transformation between names in data (JSON) and * POJOS. - * - * @since 2.7 (was formerly called {@link #PASCAL_CASE_TO_CAMEL_CASE}) */ public static final PropertyNamingStrategy LOWER_CAMEL_CASE = new PropertyNamingStrategy(); @@ -62,8 +56,6 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7 * Naming convention in which all words of the logical name are in lower case, and * no separator is used between words. * See {@link LowerCaseStrategy} for details. - * - * @since 2.4 */ public static final PropertyNamingStrategy LOWER_CASE = new LowerCaseStrategy(); @@ -71,8 +63,6 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7 * Naming convention used in languages like Lisp, where words are in lower-case * letters, separated by hyphens. * See {@link KebabCaseStrategy} for details. - * - * @since 2.7 */ public static final PropertyNamingStrategy KEBAB_CASE = new KebabCaseStrategy(); @@ -195,8 +185,7 @@ public String nameForConstructorParameter(MapperConfig config, AnnotatedParam public abstract String translate(String propertyName); } - - + /* /********************************************************** /* Standard implementations @@ -251,8 +240,6 @@ public String nameForConstructorParameter(MapperConfig config, AnnotatedParam * (the first of two underscores was removed) *

  • "user__name" is translated to "user__name" * (unchanged, with two underscores)
  • - * - * @since 2.7 (was previously called } */ public static class SnakeCaseStrategy extends PropertyNamingStrategyBase { @@ -303,8 +290,6 @@ public String translate(String input) * This rules result in the following example translation from * Java property names to JSON element names. *
    • "userName" is translated to "UserName"
    - * - * @since 2.7 (was formerly called {@link PascalCaseStrategy}) */ public static class UpperCamelCaseStrategy extends PropertyNamingStrategyBase { @@ -354,8 +339,6 @@ public String translate(String input) { * Naming strategy similar to {@link SnakeCaseStrategy}, but instead of underscores * as separators, uses hyphens. Naming convention traditionally used for languages * like Lisp. - * - * @since 2.7 */ public static class KebabCaseStrategy extends PropertyNamingStrategyBase { @@ -396,35 +379,5 @@ public String translate(String input) return result.toString(); } } - - /* - /********************************************************** - /* Deprecated variants, aliases - /********************************************************** - */ - - /** - * @deprecated Since 2.7 use {@link #SNAKE_CASE} instead; - */ - @Deprecated // since 2.7 - public static final PropertyNamingStrategy CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES = SNAKE_CASE; - - /** - * @deprecated Since 2.7 use {@link #UPPER_CAMEL_CASE} instead; - */ - @Deprecated // since 2.7 - public static final PropertyNamingStrategy PASCAL_CASE_TO_CAMEL_CASE = UPPER_CAMEL_CASE; - - /** - * @deprecated In 2.7 use {@link SnakeCaseStrategy} instead - */ - @Deprecated - public static class LowerCaseWithUnderscoresStrategy extends SnakeCaseStrategy {} - - /** - * @deprecated In 2.7 use {@link UpperCamelCaseStrategy} instead - */ - @Deprecated - public static class PascalCaseStrategy extends UpperCamelCaseStrategy {} } diff --git a/src/main/java/com/fasterxml/jackson/databind/SerializationConfig.java b/src/main/java/com/fasterxml/jackson/databind/SerializationConfig.java index eece8c62ea..beec3db270 100644 --- a/src/main/java/com/fasterxml/jackson/databind/SerializationConfig.java +++ b/src/main/java/com/fasterxml/jackson/databind/SerializationConfig.java @@ -2,8 +2,6 @@ import java.text.DateFormat; -import com.fasterxml.jackson.annotation.*; - import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.core.util.Instantiatable; @@ -28,12 +26,10 @@ */ public final class SerializationConfig extends MapperConfigBase - implements java.io.Serializable // since 2.1 + implements java.io.Serializable { - // since 2.5 - private static final long serialVersionUID = 1; + private static final long serialVersionUID = 3L; - // since 2.6 protected final static PrettyPrinter DEFAULT_PRETTY_PRINTER = new DefaultPrettyPrinter(); /* @@ -51,8 +47,6 @@ public final class SerializationConfig /** * If "default pretty-printing" is enabled, it will create the instance * from this blueprint object. - * - * @since 2.6 */ protected final PrettyPrinter _defaultPrettyPrinter; @@ -597,23 +591,6 @@ public SerializationConfig withFilters(FilterProvider filterProvider) { return (filterProvider == _filterProvider) ? this : new SerializationConfig(this, filterProvider); } - /** - * Mutant factory method for constructing a new instance with different - * default inclusion criteria configuration. - * - * @since 2.7 - * - * @deprecated Since 2.9; not needed any more - */ - @Deprecated - public SerializationConfig withPropertyInclusion(JsonInclude.Value incl) { - _configOverrides.setDefaultInclusion(incl); - return this; - } - - /** - * @since 2.6 - */ public SerializationConfig withDefaultPrettyPrinter(PrettyPrinter pp) { return (_defaultPrettyPrinter == pp) ? this: new SerializationConfig(this, pp); } @@ -642,8 +619,6 @@ public PrettyPrinter constructDefaultPrettyPrinter() { * Method called by {@link ObjectMapper} and {@link ObjectWriter} * to modify those {@link com.fasterxml.jackson.core.JsonGenerator.Feature} settings * that have been configured via this config instance. - * - * @since 2.5 */ public void initialize(JsonGenerator g) { @@ -656,18 +631,9 @@ public void initialize(JsonGenerator g) } } } - @SuppressWarnings("deprecation") - boolean useBigDec = SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN.enabledIn(_serFeatures); - int mask = _generatorFeaturesToChange; - if ((mask != 0) || useBigDec) { + if (mask != 0) { int newFlags = _generatorFeatures; - // although deprecated, needs to be supported for now - if (useBigDec) { - int f = JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN.getMask(); - newFlags |= f; - mask |= f; - } g.overrideStdFeatures(newFlags, mask); } if (_formatWriteFeaturesToChange != 0) { @@ -675,22 +641,6 @@ public void initialize(JsonGenerator g) } } - /* - /********************************************************** - /* Configuration: default settings with per-type overrides - /********************************************************** - */ - - /** - * @deprecated Since 2.7 use {@link #getDefaultPropertyInclusion} instead - */ - @Deprecated - public JsonInclude.Include getSerializationInclusion() - { - JsonInclude.Include incl = getDefaultPropertyInclusion().getValueInclusion(); - return (incl == JsonInclude.Include.USE_DEFAULTS) ? JsonInclude.Include.ALWAYS : incl; - } - /* /********************************************************** /* Configuration: other @@ -714,8 +664,6 @@ public final boolean isEnabled(SerializationFeature f) { * Accessor method that first checks if we have any overrides * for feature, and only if not, checks state of passed-in * factory. - * - * @since 2.5 */ public final boolean isEnabled(JsonGenerator.Feature f, JsonFactory factory) { int mask = f.getMask(); @@ -728,8 +676,6 @@ public final boolean isEnabled(JsonGenerator.Feature f, JsonFactory factory) { /** * "Bulk" access method for checking that all features specified by * mask are enabled. - * - * @since 2.3 */ public final boolean hasSerializationFeatures(int featureMask) { return (_serFeatures & featureMask) == featureMask; diff --git a/src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java b/src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java index 1b46dc073d..ca810d61af 100644 --- a/src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java +++ b/src/main/java/com/fasterxml/jackson/databind/SerializationFeature.java @@ -271,23 +271,6 @@ public enum SerializationFeature implements ConfigFeature */ WRITE_ENUMS_USING_INDEX(false), - /** - * Feature that determines whether Map entries with null values are - * to be serialized (true) or not (false). - *

    - * NOTE: unlike other {@link SerializationFeature}s, this feature cannot be - * dynamically changed on per-call basis, because its effect is considered during - * construction of serializers and property handlers. - *

    - * Feature is enabled by default. - * - * @deprecated Since 2.9 there are better mechanism for specifying filtering; specifically - * using {@link com.fasterxml.jackson.annotation.JsonInclude} or configuration overrides - * (see {@link ObjectMapper#configOverride(Class)}}). - */ - @Deprecated // since 2.9 - WRITE_NULL_MAP_VALUES(true), - /** * Feature that determines whether Container properties (POJO properties * with declared value of Collection or array; i.e. things that produce JSON @@ -332,25 +315,6 @@ public enum SerializationFeature implements ConfigFeature */ WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED(false), - /** - * Feature that determines whether {@link java.math.BigDecimal} entries are - * serialized using {@link java.math.BigDecimal#toPlainString()} to prevent - * values to be written using scientific notation. - *

    - * NOTE: since this feature typically requires use of - * {@link com.fasterxml.jackson.core.JsonGenerator#writeNumber(String)} - * it may cause compatibility problems since not all {@link com.fasterxml.jackson.core.JsonGenerator} - * implementations support such mode of output: usually only text-based formats - * support it. - *

    - * Feature is disabled by default. - * - * @deprecated Since 2.5: use {@link com.fasterxml.jackson.core.JsonGenerator.Feature#WRITE_BIGDECIMAL_AS_PLAIN} instead - * (using {@link ObjectWriter#with(com.fasterxml.jackson.core.JsonGenerator.Feature)}). - */ - @Deprecated // since 2.5 - WRITE_BIGDECIMAL_AS_PLAIN(false), - /** * Feature that controls whether numeric timestamp values are * to be written using nanosecond timestamps (enabled) or not (disabled); diff --git a/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java b/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java index fa299b49dd..a1f9e2a889 100644 --- a/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java @@ -336,12 +336,6 @@ public final TypeFactory getTypeFactory() { @Override public final Class getActiveView() { return _serializationView; } - - /** - * @deprecated Since 2.2, use {@link #getActiveView} instead. - */ - @Deprecated - public final Class getSerializationView() { return _serializationView; } @Override public final boolean canOverrideAccessModifiers() { @@ -358,9 +352,6 @@ public final JsonFormat.Value getDefaultPropertyFormat(Class baseType) { return _config.getDefaultPropertyFormat(baseType); } - /** - * @since 2.8 - */ public final JsonInclude.Value getDefaultPropertyInclusion(Class baseType) { return _config.getDefaultPropertyInclusion(); } @@ -1141,8 +1132,8 @@ public final void defaultSerializeNull(JsonGenerator gen) throws IOException * * @since 2.8 */ - public void reportMappingProblem(String message, Object... args) throws JsonMappingException { - throw mappingException(message, args); + public void reportMappingProblem(String message, Object... msgArgs) throws JsonMappingException { + throw JsonMappingException.from(getGenerator(), _format(message, msgArgs)); } /** @@ -1153,7 +1144,8 @@ public void reportMappingProblem(String message, Object... args) throws JsonMapp * @since 2.9 */ public T reportBadTypeDefinition(BeanDescription bean, - String msg, Object... msgArgs) throws JsonMappingException { + String msg, Object... msgArgs) throws JsonMappingException + { String beanDesc = "N/A"; if (bean != null) { beanDesc = ClassUtil.nameOf(bean.getBeanClass()); @@ -1231,40 +1223,6 @@ public JsonMappingException invalidTypeIdException(JavaType baseType, String typ return InvalidTypeIdException.from(null, _colonConcat(msg, extraDesc), baseType, typeId); } - /* - /******************************************************** - /* Error reporting, deprecated methods - /******************************************************** - */ - - /** - * Factory method for constructing a {@link JsonMappingException}; - * usually only indirectly used by calling - * {@link #reportMappingProblem(String, Object...)}. - * - * @since 2.6 - * - * @deprecated Since 2.9 - */ - @Deprecated // since 2.9 - public JsonMappingException mappingException(String message, Object... msgArgs) { - return JsonMappingException.from(getGenerator(), _format(message, msgArgs)); - } - - /** - * Factory method for constructing a {@link JsonMappingException}; - * usually only indirectly used by calling - * {@link #reportMappingProblem(Throwable, String, Object...)} - * - * @since 2.8 - * - * @deprecated Since 2.9 - */ - @Deprecated // since 2.9 - protected JsonMappingException mappingException(Throwable t, String message, Object... msgArgs) { - return JsonMappingException.from(getGenerator(), _format(message, msgArgs), t); - } - /* /******************************************************** /* Helper methods @@ -1369,9 +1327,6 @@ protected JsonSerializer _createAndCacheUntypedSerializer(JavaType type) return ser; } - /** - * @since 2.1 - */ protected JsonSerializer _createUntypedSerializer(JavaType type) throws JsonMappingException { @@ -1381,7 +1336,6 @@ protected JsonSerializer _createUntypedSerializer(JavaType type) * Perhaps not-yet-resolved instance might be exposed too early to callers. */ synchronized (_serializerCache) { - // 17-Feb-2013, tatu: Used to call deprecated method (that passed property) return (JsonSerializer)_serializerFactory.createSerializer(this, type); } } diff --git a/src/main/java/com/fasterxml/jackson/databind/annotation/JsonSerialize.java b/src/main/java/com/fasterxml/jackson/databind/annotation/JsonSerialize.java index 19767feeb3..7f66e23dca 100644 --- a/src/main/java/com/fasterxml/jackson/databind/annotation/JsonSerialize.java +++ b/src/main/java/com/fasterxml/jackson/databind/annotation/JsonSerialize.java @@ -69,8 +69,6 @@ public Class keyUsing() * default null serializer. * Note that using this property when annotation types (classes) has * no effect currently (it is possible this could be improved in future). - * - * @since 2.3 */ @SuppressWarnings("rawtypes") // to work around JDK8 bug wrt Class-valued annotation properties public Class nullsUsing() @@ -125,14 +123,12 @@ public Class nullsUsing() */ public Typing typing() default Typing.DEFAULT_TYPING; - // // // Annotations for specifying intermediate Converters (2.2+) - + // // // Annotations for specifying intermediate Converters + /** * Which helper object is to be used to convert type into something * that Jackson knows how to serialize; either because base type * cannot be serialized easily, or just to alter serialization. - * - * @since 2.2 */ @SuppressWarnings("rawtypes") // to work around JDK8 bug wrt Class-valued annotation properties public Class converter() default Converter.None.class; @@ -144,100 +140,9 @@ public Class nullsUsing() * it can only be used as property annotation: this because association between * container and value types is loose and as such converters seldom make sense * for such usage. - * - * @since 2.2 */ @SuppressWarnings("rawtypes") // to work around JDK8 bug wrt Class-valued annotation properties public Class contentConverter() default Converter.None.class; - - // // // Annotation(s) for inclusion criteria - - /** - * Which properties of annotated Bean are - * to be included in serialization (has no effect on other types - * like enums, primitives or collections). - * Choices are "all", "properties that have value other than null" - * and "properties that have non-default value" (i.e. default value - * being property setting for a Bean constructed with default no-arg - * constructor, often null). - *

    - * This property has been replaced by special-purpose {@link com.fasterxml.jackson.annotation.JsonInclude} - * annotation, introduced in Jackson 2.0. - *

    - * Note that Jackson 2.3 changed default to DEFAULT_INCLUSION, - * which is roughly same as saying "whatever". This is important because - * it allows hierarchic default values to be used. - * - * @deprecated As of Jackson 2.0, this annotation has been replaced - * by {@link com.fasterxml.jackson.annotation.JsonInclude} - */ - @Deprecated - public Inclusion include() default Inclusion.DEFAULT_INCLUSION; - - /* - /********************************************************** - /* Value enumerations needed - /********************************************************** - */ - - /** - * Enumeration used with {@link JsonSerialize#include} property - * to define which properties - * of Java Beans are to be included in serialization - */ - @Deprecated // since 2.0, marked deprecated in 2.6 - public enum Inclusion - { - /** - * Value that indicates that properties are to be always included, - * independent of value - */ - ALWAYS, - - /** - * Value that indicates that only properties with non-null - * values are to be included. - */ - NON_NULL, - - /** - * Value that indicates that only properties that have values - * that differ from default settings (meaning values they have - * when Bean is constructed with its no-arguments constructor) - * are to be included. Value is generally not useful with - * {@link java.util.Map}s, since they have no default values; - * and if used, works same as {@link #ALWAYS}. - */ - NON_DEFAULT, - - /** - * Value that indicates that only properties that have values - * that values that are null or what is considered empty are - * not to be included. - * Emptiness is defined for following type: - *

      - *
    • For {@link java.util.Collection}s and {@link java.util.Map}s, - * method isEmpty() is called; - *
    • - *
    • For Java arrays, empty arrays are ones with length of 0 - *
    • - *
    • For Java {@link java.lang.String}s, length() is called, - * and return value of 0 indicates empty String - *
    • - *
    - * For other types, non-null values are to be included. - */ - NON_EMPTY, - - /** - * Pseudo-value that is used to indicate - * "use whatever is default used at higher level". - * - * @since 2.3 - */ - DEFAULT_INCLUSION - ; - } /** * Enumeration used with {@link JsonSerialize#typing} property @@ -261,8 +166,6 @@ public enum Typing /** * Pseudo-value that is used to indicate * "use whatever is default used at higher level". - * - * @since 2.3 */ DEFAULT_TYPING ; diff --git a/src/main/java/com/fasterxml/jackson/databind/cfg/MapperConfigBase.java b/src/main/java/com/fasterxml/jackson/databind/cfg/MapperConfigBase.java index a8a535c72f..e548a204dd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/cfg/MapperConfigBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/cfg/MapperConfigBase.java @@ -24,16 +24,10 @@ public abstract class MapperConfigBase implements java.io.Serializable { - /** - * @since 2.9 - */ protected final static ConfigOverride EMPTY_OVERRIDE = ConfigOverride.empty(); private final static int DEFAULT_MAPPER_FEATURES = collectFeatureDefaults(MapperFeature.class); - /** - * @since 2.9 - */ private final static int AUTO_DETECT_MASK = MapperFeature.AUTO_DETECT_FIELDS.getMask() | MapperFeature.AUTO_DETECT_GETTERS.getMask() @@ -51,8 +45,6 @@ public abstract class MapperConfigBase implements ContextualDeserializer, ResolvableDeserializer, - ValueInstantiator.Gettable, // since 2.9 - java.io.Serializable // since 2.1 + ValueInstantiator.Gettable, + java.io.Serializable { private static final long serialVersionUID = 1; @@ -983,12 +983,6 @@ public Collection getKnownPropertyNames() { return names; } - /** - * @deprecated Since 2.3, use {@link #handledType()} instead - */ - @Deprecated - public final Class getBeanClass() { return _beanType.getRawClass(); } - @Override public JavaType getValueType() { return _beanType; } @@ -1011,8 +1005,6 @@ public Iterator properties() * Accessor for finding properties that represents values to pass * through property-based creator method (constructor or * factory method) - * - * @since 2.0 */ public Iterator creatorProperties() { diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/DeserializationProblemHandler.java b/src/main/java/com/fasterxml/jackson/databind/deser/DeserializationProblemHandler.java index 38b87051bd..501cff8f4a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/DeserializationProblemHandler.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/DeserializationProblemHandler.java @@ -301,9 +301,7 @@ public Object handleMissingInstantiator(DeserializationContext ctxt, String msg) throws IOException { - // 16-Oct-2016, tatu: Need to delegate to deprecated method from 2.8; - // remove redirect from later versions (post-2.9) - return handleMissingInstantiator(ctxt, instClass, p, msg); + return NOT_HANDLED; } /** @@ -379,22 +377,4 @@ public JavaType handleMissingTypeId(DeserializationContext ctxt, { return null; } - - /* - /********************************************************** - /* Deprecated - /********************************************************** - */ - - /** - * @since 2.8 - * @deprecated Since 2.9: use variant that takes {@link ValueInstantiator} - */ - @Deprecated - public Object handleMissingInstantiator(DeserializationContext ctxt, - Class instClass, JsonParser p, String msg) - throws IOException - { - return NOT_HANDLED; - } } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java index ae11562544..4d9833b9ea 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/SettableAnyProperty.java @@ -43,10 +43,6 @@ public class SettableAnyProperty protected JsonDeserializer _valueDeserializer; protected final TypeDeserializer _valueTypeDeserializer; - - /** - * @since 2.9 - */ protected final KeyDeserializer _keyDeserializer; /* @@ -68,13 +64,6 @@ public SettableAnyProperty(BeanProperty property, AnnotatedMember setter, JavaTy _setterIsField = setter instanceof AnnotatedField; } - @Deprecated // since 2.9 - public SettableAnyProperty(BeanProperty property, AnnotatedMember setter, JavaType type, - JsonDeserializer valueDeser, TypeDeserializer typeDeser) - { - this(property, setter, type, null, valueDeser, typeDeser); - } - public SettableAnyProperty withValueDeserializer(JsonDeserializer deser) { return new SettableAnyProperty(_property, _setter, _type, _keyDeserializer, deser, _valueTypeDeserializer); diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/UnresolvedForwardReference.java b/src/main/java/com/fasterxml/jackson/databind/deser/UnresolvedForwardReference.java index 50ace58d41..2be01db2ae 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/UnresolvedForwardReference.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/UnresolvedForwardReference.java @@ -13,48 +13,23 @@ /** * Exception thrown during deserialization when there are object id that can't * be resolved. - * - * @author pgelinas */ -public class UnresolvedForwardReference extends JsonMappingException { +public class UnresolvedForwardReference extends JsonMappingException +{ private static final long serialVersionUID = 1L; private ReadableObjectId _roid; private List _unresolvedIds; - /** - * @since 2.7 - */ public UnresolvedForwardReference(JsonParser p, String msg, JsonLocation loc, ReadableObjectId roid) { super(p, msg, loc); _roid = roid; } - /** - * @since 2.7 - */ public UnresolvedForwardReference(JsonParser p, String msg) { super(p, msg); _unresolvedIds = new ArrayList(); } - /** - * @deprecated Since 2.7 - */ - @Deprecated // since 2.7 - public UnresolvedForwardReference(String msg, JsonLocation loc, ReadableObjectId roid) { - super(msg, loc); - _roid = roid; - } - - /** - * @deprecated Since 2.7 - */ - @Deprecated // since 2.7 - public UnresolvedForwardReference(String msg) { - super(msg); - _unresolvedIds = new ArrayList(); - } - /* /********************************************************** /* Accessor methods diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMap.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMap.java index ee5044792b..bb43372061 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMap.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMap.java @@ -32,9 +32,6 @@ public class BeanPropertyMap { private static final long serialVersionUID = 2L; - /** - * @since 2.5 - */ protected final boolean _caseInsensitive; private int _hashMask; @@ -75,10 +72,7 @@ public class BeanPropertyMap * @since 2.9 */ private final Map _aliasMapping; - - /** - * @since 2.9 - */ + public BeanPropertyMap(boolean caseInsensitive, Collection props, Map> aliasDefs) { @@ -89,15 +83,6 @@ public BeanPropertyMap(boolean caseInsensitive, Collection init(props); } - @Deprecated // since 2.8 - public BeanPropertyMap(boolean caseInsensitive, Collection props) - { - this(caseInsensitive, props, Collections.>emptyMap()); - } - - /** - * @since 2.8 - */ protected BeanPropertyMap(BeanPropertyMap base, boolean caseInsensitive) { _caseInsensitive = caseInsensitive; @@ -113,8 +98,6 @@ protected BeanPropertyMap(BeanPropertyMap base, boolean caseInsensitive) * Mutant factory method that constructs a new instance if desired case-insensitivity * state differs from the state of this instance; if states are the same, returns * this. - * - * @since 2.8 */ public BeanPropertyMap withCaseInsensitivity(boolean state) { if (_caseInsensitive == state) { @@ -187,21 +170,12 @@ private final static int findSize(int size) } return result; } - - /** - * @since 2.6 - */ + public static BeanPropertyMap construct(Collection props, boolean caseInsensitive, Map> aliasMapping) { return new BeanPropertyMap(caseInsensitive, props, aliasMapping); } - @Deprecated // since 2.9 - public static BeanPropertyMap construct(Collection props, boolean caseInsensitive) { - return construct(props, caseInsensitive, - Collections.>emptyMap()); - } - /** * Fluent copy method that creates a new instance that is a copy * of this instance except for one additional property that is diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java index 14f0755d01..a3c3e77105 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java @@ -2,7 +2,6 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Member; -import java.lang.reflect.Type; import java.util.*; import com.fasterxml.jackson.databind.*; @@ -17,8 +16,8 @@ * Container class for storing information on creators (based on annotations, * visibility), to be able to build actual instantiator later on. */ -public class CreatorCollector { - // Since 2.5 +public class CreatorCollector +{ protected final static int C_DEFAULT = 0; protected final static int C_STRING = 1; protected final static int C_INT = 2; @@ -38,15 +37,10 @@ public class CreatorCollector { final protected boolean _canFixAccess; - /** - * @since 2.7 - */ final protected boolean _forceAccess; /** * Set of creators we have collected so far - * - * @since 2.5 */ protected final AnnotatedWithParams[] _creators = new AnnotatedWithParams[9]; @@ -54,8 +48,6 @@ public class CreatorCollector { * Bitmask of creators that were explicitly marked as creators; false for * auto-detected (ones included base on naming and/or visibility, not * annotation) - * - * @since 2.5 */ protected int _explicitCreators = 0; @@ -410,12 +402,6 @@ public JavaType getParameterType(int index) { return _base.getParameterType(index); } - @Override - @Deprecated - public Type getGenericParameterType(int index) { - return _base.getGenericParameterType(index); - } - @Override public Object call() throws Exception { return _construct(); diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyBasedCreator.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyBasedCreator.java index 4e7bc44154..2fb2bc3419 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyBasedCreator.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyBasedCreator.java @@ -136,15 +136,6 @@ public static PropertyBasedCreator construct(DeserializationContext ctxt, caseInsensitive, false); } - @Deprecated // since 2.9 - public static PropertyBasedCreator construct(DeserializationContext ctxt, - ValueInstantiator valueInstantiator, SettableBeanProperty[] srcCreatorProps) - throws JsonMappingException - { - return construct(ctxt, valueInstantiator, srcCreatorProps, - ctxt.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)); - } - /* /********************************************************** /* Accessors diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java index 4ac61dcebb..9d5ed53f41 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java @@ -28,30 +28,19 @@ public class EnumDeserializer private static final long serialVersionUID = 1L; protected Object[] _enumsByIndex; - - /** - * @since 2.8 - */ + private final Enum _enumDefaultValue; - /** - * @since 2.7.3 - */ protected final CompactStringObjectMap _lookupByName; /** * Alternatively, we may need a different lookup object if "use toString" * is defined. - * - * @since 2.7.3 */ protected CompactStringObjectMap _lookupByToString; protected final Boolean _caseInsensitive; - /** - * @since 2.9 - */ public EnumDeserializer(EnumResolver byNameResolver, Boolean caseInsensitive) { super(byNameResolver.getEnumClass()); @@ -61,9 +50,6 @@ public EnumDeserializer(EnumResolver byNameResolver, Boolean caseInsensitive) _caseInsensitive = caseInsensitive; } - /** - * @since 2.9 - */ protected EnumDeserializer(EnumDeserializer base, Boolean caseInsensitive) { super(base); @@ -73,30 +59,11 @@ protected EnumDeserializer(EnumDeserializer base, Boolean caseInsensitive) _caseInsensitive = caseInsensitive; } - /** - * @deprecated Since 2.9 - */ - @Deprecated - public EnumDeserializer(EnumResolver byNameResolver) { - this(byNameResolver, null); - } - - /** - * @deprecated Since 2.8 - */ - @Deprecated - public static JsonDeserializer deserializerForCreator(DeserializationConfig config, - Class enumClass, AnnotatedMethod factory) { - return deserializerForCreator(config, enumClass, factory, null, null); - } - /** * Factory method used when Enum instances are to be deserialized * using a creator (static factory method) * * @return Deserializer based on given factory method - * - * @since 2.8 */ public static JsonDeserializer deserializerForCreator(DeserializationConfig config, Class enumClass, AnnotatedMethod factory, diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java index 2fe914f068..3e09fe15e0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java @@ -41,10 +41,7 @@ public class EnumMapDeserializer protected final TypeDeserializer _valueTypeDeserializer; // // Instance construction settings: - - /** - * @since 2.9 - */ + protected final ValueInstantiator _valueInstantiator; /** @@ -100,13 +97,6 @@ protected EnumMapDeserializer(EnumMapDeserializer base, _propertyBasedCreator = base._propertyBasedCreator; } - @Deprecated // since 2.9 - public EnumMapDeserializer(JavaType mapType, KeyDeserializer keyDeser, - JsonDeserializer valueDeser, TypeDeserializer vtd) - { - this(mapType, null, keyDeser, valueDeser, vtd, null); - } - public EnumMapDeserializer withResolved(KeyDeserializer keyDeserializer, JsonDeserializer valueDeserializer, TypeDeserializer valueTypeDeser, NullValueProvider nuller) diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java index 8678970a02..ea65a7fced 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java @@ -37,8 +37,6 @@ public abstract class StdDeserializer * Bitmask that covers {@link DeserializationFeature#USE_BIG_INTEGER_FOR_INTS} * and {@link DeserializationFeature#USE_LONG_FOR_INTS}, used for more efficient * cheks when coercing integral values for untyped deserialization. - * - * @since 2.6 */ protected final static int F_MASK_INT_COERCIONS = DeserializationFeature.USE_BIG_INTEGER_FOR_INTS.getMask() @@ -91,12 +89,6 @@ protected StdDeserializer(StdDeserializer src) { /********************************************************** */ - /** - * @deprecated Since 2.3 use {@link #handledType} instead - */ - @Deprecated - public final Class getValueClass() { return _valueClass; } - /** * Exact structured type this deserializer handles, if known. *

    @@ -1132,7 +1124,7 @@ protected final NullValueProvider _findNullProvider(DeserializationContext ctxt, * error reporting functionality * @param instanceOrClass Instance that is being populated by this * deserializer, or if not known, Class that would be instantiated. - * If null, will assume type is what {@link #getValueClass} returns. + * If null, will assume type is what {@link #handledType} returns. * @param propName Name of the property that cannot be mapped */ protected void handleUnknownProperty(JsonParser p, DeserializationContext ctxt, diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java index 1495a99e46..08b43d5746 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.deser.*; import com.fasterxml.jackson.databind.introspect.AnnotatedParameter; import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams; -import com.fasterxml.jackson.databind.util.ClassUtil; /** * Default {@link ValueInstantiator} implementation, which supports @@ -28,9 +27,6 @@ public class StdValueInstantiator */ protected final String _valueTypeDesc; - /** - * @since 2.8 - */ protected final Class _valueClass; // // // Default (no-args) construction @@ -75,15 +71,6 @@ public class StdValueInstantiator /********************************************************** */ - /** - * @deprecated Since 2.7 use constructor that takes {@link JavaType} instead - */ - @Deprecated - public StdValueInstantiator(DeserializationConfig config, Class valueType) { - _valueTypeDesc = ClassUtil.nameOf(valueType); - _valueClass = (valueType == null) ? Object.class : valueType; - } - public StdValueInstantiator(DeserializationConfig config, JavaType valueType) { _valueTypeDesc = (valueType == null) ? "UNKNOWN TYPE" : valueType.toString(); _valueClass = (valueType == null) ? Object.class : valueType.getRawClass(); @@ -429,27 +416,6 @@ public AnnotatedParameter getIncompleteParameter() { /********************************************************** */ - /** - * @deprecated Since 2.7 call either {@link #unwrapAndWrapException} or - * {@link #wrapAsJsonMappingException} - */ - @Deprecated // since 2.7 - protected JsonMappingException wrapException(Throwable t) - { - // 05-Nov-2015, tatu: This used to always unwrap the whole exception, but now only - // does so if and until `JsonMappingException` is found. - for (Throwable curr = t; curr != null; curr = curr.getCause()) { - if (curr instanceof JsonMappingException) { - return (JsonMappingException) curr; - } - } - return new JsonMappingException(null, - "Instantiation of "+getValueTypeDesc()+" value failed: "+t.getMessage(), t); - } - - /** - * @since 2.7 - */ protected JsonMappingException unwrapAndWrapException(DeserializationContext ctxt, Throwable t) { // 05-Nov-2015, tatu: This used to always unwrap the whole exception, but now only @@ -462,9 +428,6 @@ protected JsonMappingException unwrapAndWrapException(DeserializationContext ctx return ctxt.instantiationException(getValueClass(), t); } - /** - * @since 2.7 - */ protected JsonMappingException wrapAsJsonMappingException(DeserializationContext ctxt, Throwable t) { @@ -475,9 +438,6 @@ protected JsonMappingException wrapAsJsonMappingException(DeserializationContext return ctxt.instantiationException(getValueClass(), t); } - /** - * @since 2.7 - */ protected JsonMappingException rewrapCtorProblem(DeserializationContext ctxt, Throwable t) { diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java b/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java index e78ad5216c..47396ede2c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java +++ b/src/main/java/com/fasterxml/jackson/databind/exc/IgnoredPropertyException.java @@ -10,17 +10,12 @@ * Specialized {@link JsonMappingException} sub-class used to indicate * case where an explicitly ignored property is encountered, and mapper * is configured to consider this an error. - * - * @since 2.3 */ public class IgnoredPropertyException extends PropertyBindingException { private static final long serialVersionUID = 1L; - /** - * @since 2.7 - */ public IgnoredPropertyException(JsonParser p, String msg, JsonLocation loc, Class referringClass, String propName, Collection propertyIds) @@ -28,17 +23,6 @@ public IgnoredPropertyException(JsonParser p, String msg, JsonLocation loc, super(p, msg, loc, referringClass, propName, propertyIds); } - /** - * @deprecated Since 2.7 - */ - @Deprecated - public IgnoredPropertyException(String msg, JsonLocation loc, - Class referringClass, String propName, - Collection propertyIds) - { - super(msg, loc, referringClass, propName, propertyIds); - } - /** * Factory method used for constructing instances of this exception type. * diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/InvalidFormatException.java b/src/main/java/com/fasterxml/jackson/databind/exc/InvalidFormatException.java index b1b8b105c2..3d0921adff 100644 --- a/src/main/java/com/fasterxml/jackson/databind/exc/InvalidFormatException.java +++ b/src/main/java/com/fasterxml/jackson/databind/exc/InvalidFormatException.java @@ -1,19 +1,16 @@ package com.fasterxml.jackson.databind.exc; -import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.core.JsonParser; /** * Specialized sub-class of {@link MismatchedInputException} * that is used when the underlying problem appears to be that * of bad formatting of a value to deserialize. - * - * @since 2.1 */ public class InvalidFormatException - extends MismatchedInputException // since 2.9 + extends MismatchedInputException { - private static final long serialVersionUID = 1L; // silly Eclipse, warnings + private static final long serialVersionUID = 1L; /** * Underlying value that could not be deserialized into @@ -27,33 +24,6 @@ public class InvalidFormatException /********************************************************** */ - /** - * @deprecated Since 2.7 Use variant that takes {@link JsonParser} - */ - @Deprecated // since 2.7 - public InvalidFormatException(String msg, - Object value, Class targetType) - { - super(null, msg); - _value = value; - _targetType = targetType; - } - - /** - * @deprecated Since 2.7 Use variant that takes {@link JsonParser} - */ - @Deprecated // since 2.7 - public InvalidFormatException(String msg, JsonLocation loc, - Object value, Class targetType) - { - super(null, msg, loc); - _value = value; - _targetType = targetType; - } - - /** - * @since 2.7 - */ public InvalidFormatException(JsonParser p, String msg, Object value, Class targetType) { diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/MismatchedInputException.java b/src/main/java/com/fasterxml/jackson/databind/exc/MismatchedInputException.java index 183831a90c..90dfb33077 100644 --- a/src/main/java/com/fasterxml/jackson/databind/exc/MismatchedInputException.java +++ b/src/main/java/com/fasterxml/jackson/databind/exc/MismatchedInputException.java @@ -19,8 +19,6 @@ * NOTE: name chosen to differ from `java.util.InputMismatchException` since while that * would have been better name, use of same overlapping name causes nasty issues * with IDE auto-completion, so slightly less optimal chosen. - * - * @since 2.9 */ @SuppressWarnings("serial") public class MismatchedInputException @@ -49,12 +47,6 @@ protected MismatchedInputException(JsonParser p, String msg, JavaType targetType _targetType = ClassUtil.rawClass(targetType); } - // Only to prevent super-class static method from getting called - @Deprecated // as of 2.9 - public static MismatchedInputException from(JsonParser p, String msg) { - return from(p, (Class) null, msg); - } - public static MismatchedInputException from(JsonParser p, JavaType targetType, String msg) { return new MismatchedInputException(p, msg, targetType); } diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java b/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java index 7e5c63077e..fc8638fbea 100644 --- a/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java +++ b/src/main/java/com/fasterxml/jackson/databind/exc/PropertyBindingException.java @@ -11,8 +11,6 @@ /** * Base class for {@link JsonMappingException}s that are specifically related * to problems related to binding an individual property. - * - * @since 2.3 */ @SuppressWarnings("serial") public abstract class PropertyBindingException @@ -42,9 +40,6 @@ public abstract class PropertyBindingException */ protected transient String _propertiesAsString; - /** - * @since 2.7 - */ protected PropertyBindingException(JsonParser p, String msg, JsonLocation loc, Class referringClass, String propName, Collection propertyIds) @@ -55,17 +50,6 @@ protected PropertyBindingException(JsonParser p, String msg, JsonLocation loc, _propertyIds = propertyIds; } - /** - * @deprecated Since 2.7 - */ - @Deprecated // since 2.7 - protected PropertyBindingException(String msg, JsonLocation loc, - Class referringClass, String propName, - Collection propertyIds) - { - this(null, msg, loc, referringClass, propName, propertyIds); - } - /* /********************************************************** /* Overrides diff --git a/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java b/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java index fda5674b5d..21671dafc1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java +++ b/src/main/java/com/fasterxml/jackson/databind/exc/UnrecognizedPropertyException.java @@ -24,17 +24,6 @@ public UnrecognizedPropertyException(JsonParser p, String msg, JsonLocation loc, super(p, msg, loc, referringClass, propName, propertyIds); } - /** - * @deprecated Since 2.7 - */ - @Deprecated // since 2.7 - public UnrecognizedPropertyException(String msg, JsonLocation loc, - Class referringClass, String propName, - Collection propertyIds) - { - super(msg, loc, referringClass, propName, propertyIds); - } - /** * Factory method used for constructing instances of this exception type. * diff --git a/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java index 9095b32c17..ce931e7b0c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.ser.std.StdSerializer; @@ -40,12 +39,6 @@ public void serialize(Node value, JsonGenerator jgen, SerializerProvider provide jgen.writeString(writer.writeToString(value)); } - @Override - public JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint) { - // Well... it is serialized as String - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { if (visitor != null) visitor.expectAnyFormat(typeHint); diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java b/src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java index e71a536f43..8e716b2697 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/Annotated.java @@ -3,10 +3,8 @@ import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Modifier; -import java.lang.reflect.Type; import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.type.TypeBindings; /** * Shared base class used for anything on which annotations (included @@ -20,9 +18,6 @@ protected Annotated() { } public abstract boolean hasAnnotation(Class acls); - /** - * @since 2.7 - */ public abstract boolean hasOneOf(Class[] annoClasses); /** @@ -43,33 +38,9 @@ public boolean isPublic() { /** * Full generic type of the annotated element; definition * of what exactly this means depends on sub-class. - * - * @since 2.7 */ public abstract JavaType getType(); - /** - * @deprecated Since 2.7 Use {@link #getType()} instead. To be removed from 2.9 - */ - @Deprecated - public final JavaType getType(TypeBindings bogus) { - return getType(); - } - - /** - * JDK declared generic type of the annotated element; definition - * of what exactly this means depends on sub-class. Note that such type - * cannot be reliably resolved without {@link TypeResolutionContext}, and - * as a result use of this method was deprecated in Jackson 2.7: see - * {@link #getType} for replacement. - * - * @deprecated Since 2.7 should instead use {@link #getType()}. To be removed from 2.9 - */ - @Deprecated - public Type getGenericType() { - return getRawType(); - } - /** * "Raw" type (type-erased class) of the annotated element; definition * of what exactly this means depends on sub-class. diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java index 0974e82fb1..dc436371bc 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.AnnotationIntrospector; import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.ClassIntrospector.MixInResolver; import com.fasterxml.jackson.databind.type.TypeBindings; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -27,9 +26,6 @@ public final class AnnotatedClass /********************************************************** */ - /** - * @since 2.7 - */ final protected JavaType _type; /** @@ -40,8 +36,6 @@ public final class AnnotatedClass /** * Type bindings to use for members of {@link #_class}. - * - * @since 2.7 */ final protected TypeBindings _bindings; @@ -58,9 +52,6 @@ public final class AnnotatedClass */ final protected AnnotationIntrospector _annotationIntrospector; - /** - * @since 2.7 - */ final protected TypeFactory _typeFactory; /** @@ -145,8 +136,6 @@ public final class AnnotatedClass /** * Constructor (only) used for creating primordial simple types (during bootstrapping) * and array type placeholders where no fields or methods are needed. - * - * @since 2.9 */ AnnotatedClass(Class rawType) { _type = null; @@ -160,47 +149,6 @@ public final class AnnotatedClass _typeFactory = null; } - /** - * @deprecated Since 2.9, use methods in {@link AnnotatedClassResolver} instead. - */ - @Deprecated - public static AnnotatedClass construct(JavaType type, MapperConfig config) { - return construct(type, config, (MixInResolver) config); - } - - /** - * @deprecated Since 2.9, use methods in {@link AnnotatedClassResolver} instead. - */ - @Deprecated - public static AnnotatedClass construct(JavaType type, MapperConfig config, - MixInResolver mir) - { - return AnnotatedClassResolver.resolve(config, type, mir); - } - - /** - * Method similar to {@link #construct}, but that will NOT include - * information from supertypes; only class itself and any direct - * mix-ins it may have. - */ - /** - * @deprecated Since 2.9, use methods in {@link AnnotatedClassResolver} instead. - */ - @Deprecated - public static AnnotatedClass constructWithoutSuperTypes(Class raw, MapperConfig config) { - return constructWithoutSuperTypes(raw, config, config); - } - - /** - * @deprecated Since 2.9, use methods in {@link AnnotatedClassResolver} instead. - */ - @Deprecated - public static AnnotatedClass constructWithoutSuperTypes(Class raw, MapperConfig config, - MixInResolver mir) - { - return AnnotatedClassResolver.resolveWithoutSuperTypes(config, raw, mir); - } - /* /********************************************************** /* TypeResolutionContext implementation @@ -274,21 +222,10 @@ public List getConstructors() { return _creators().constructors; } - /** - * @since 2.9 - */ public List getFactoryMethods() { return _creators().creatorMethods; } - /** - * @deprecated Since 2.9; use {@link #getFactoryMethods} instead. - */ - @Deprecated - public List getStaticMethods() { - return getFactoryMethods(); - } - public Iterable memberMethods() { return _methods(); } @@ -309,9 +246,6 @@ public Iterable fields() { return _fields(); } - /** - * @since 2.9 - */ public boolean isNonStaticInnerClass() { Boolean B = _nonStaticInnerClass; diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedConstructor.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedConstructor.java index 4e17a00d35..e26b85b2ce 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedConstructor.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedConstructor.java @@ -104,16 +104,6 @@ public JavaType getParameterType(int index) { return _typeContext.resolveType(types[index]); } - @Override - @Deprecated // since 2.7 - public Type getGenericParameterType(int index) { - Type[] types = _constructor.getGenericParameterTypes(); - if (index >= types.length) { - return null; - } - return types[index]; - } - @Override public final Object call() throws Exception { return _constructor.newInstance(); diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedField.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedField.java index b81c51ec4e..e905f95f8d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedField.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedField.java @@ -75,12 +75,6 @@ public Class getRawType() { return _field.getType(); } - @Deprecated - @Override - public Type getGenericType() { - return _field.getGenericType(); - } - @Override public JavaType getType() { return _typeContext.resolveType(_field.getGenericType()); diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMember.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMember.java index 40bbe6dbab..af466f6942 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMember.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMember.java @@ -22,8 +22,6 @@ public abstract class AnnotatedMember /** * Context object needed for resolving generic type associated with this * member (method parameter or return value, or field type). - * - * @since 2.7 */ protected final transient TypeResolutionContext _typeContext; @@ -39,8 +37,6 @@ protected AnnotatedMember(TypeResolutionContext ctxt, AnnotationMap annotations) /** * Copy-constructor. - * - * @since 2.5 */ protected AnnotatedMember(AnnotatedMember base) { _typeContext = base._typeContext; @@ -50,8 +46,6 @@ protected AnnotatedMember(AnnotatedMember base) { /** * Fluent factory method that will construct a new instance that uses specified * instance annotations instead of currently configured ones. - * - * @since 2.9 (promoted from `Annotated`) */ public abstract Annotated withAnnotations(AnnotationMap fallback); @@ -66,19 +60,6 @@ public String getFullName() { return getDeclaringClass().getName() + "#" + getName(); } - /** - * Accessor for {@link TypeResolutionContext} that is used for resolving - * full generic type of this member. - * - * @since 2.7 - * - * @deprecated Since 2.9 - */ - @Deprecated - public TypeResolutionContext getTypeContext() { - return _typeContext; - } - @Override public final A getAnnotation(Class acls) { if (_annotations == null) { @@ -103,10 +84,6 @@ public boolean hasOneOf(Class[] annoClasses) { return _annotations.hasOneOf(annoClasses); } - /** - *

    - * NOTE: promoted in 2.9 from `Annotated` up - */ public AnnotationMap getAllAnnotations() { // alas, used by at least one module, hence public return _annotations; } @@ -120,8 +97,6 @@ public AnnotationMap getAllAnnotations() { // alas, used by at least one module, * {@link com.fasterxml.jackson.databind.MapperFeature#CAN_OVERRIDE_ACCESS_MODIFIERS} * is enabled before calling this method; as well as pass * force flag appropriately. - * - * @since 2.7 */ public final void fixAccess(boolean force) { Member m = getMember(); diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethod.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethod.java index 2338987129..9aa2011293 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethod.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethod.java @@ -87,12 +87,6 @@ public Class getRawType() { return _method.getReturnType(); } - @Deprecated - @Override - public Type getGenericType() { - return _method.getGenericReturnType(); - } - /* /***************************************************** /* AnnotatedWithParams @@ -149,16 +143,6 @@ public JavaType getParameterType(int index) { return _typeContext.resolveType(types[index]); } - @Override - @Deprecated // since 2.7 - public Type getGenericParameterType(int index) { - Type[] types = getGenericParameterTypes(); - if (index >= types.length) { - return null; - } - return types[index]; - } - @Override public Class getDeclaringClass() { return _method.getDeclaringClass(); } diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedParameter.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedParameter.java index 9835c35852..f38ab57fa6 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedParameter.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedParameter.java @@ -93,12 +93,6 @@ public JavaType getType() { return _type; } - @Deprecated - @Override - public Type getGenericType() { - return _owner.getGenericParameterType(_index); - } - /* /********************************************************** /* AnnotatedMember extras @@ -112,9 +106,8 @@ public Class getDeclaringClass() { @Override public Member getMember() { - /* This is bit tricky: since there is no JDK equivalent; can either - * return null or owner... let's do latter, for now. - */ + // This is bit tricky: since there is no JDK equivalent; can either + // return null or owner... let's do latter, for now. return _owner.getMember(); } diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedWithParams.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedWithParams.java index 4f415a68e3..bf172bfd85 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedWithParams.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedWithParams.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.introspect; import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import com.fasterxml.jackson.databind.JavaType; @@ -32,9 +31,6 @@ protected AnnotatedWithParams(TypeResolutionContext ctxt, AnnotationMap annotati _paramAnnotations = paramAnnotations; } - /** - * @since 2.8.1 - */ protected AnnotatedWithParams(AnnotatedWithParams base, AnnotationMap[] paramAnnotations) { super(base); _paramAnnotations = paramAnnotations; @@ -91,17 +87,8 @@ public final AnnotatedParameter getParameter(int index) { public abstract Class getRawParameterType(int index); - /** - * @since 2.7 - */ public abstract JavaType getParameterType(int index); - /** - * @deprecated Since 2.7, remove in 2.9 - */ - @Deprecated - public abstract Type getGenericParameterType(int index); - public final int getAnnotationCount() { return _annotations.size(); } /** diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/BasicBeanDescription.java b/src/main/java/com/fasterxml/jackson/databind/introspect/BasicBeanDescription.java index 538c0defbd..d59f9072f0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/BasicBeanDescription.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/BasicBeanDescription.java @@ -26,7 +26,6 @@ */ public class BasicBeanDescription extends BeanDescription { - // since 2.9 private final static Class[] NO_VIEWS = new Class[0]; /* @@ -57,14 +56,8 @@ public class BasicBeanDescription extends BeanDescription */ final protected AnnotatedClass _classInfo; - /** - * @since 2.9 - */ protected Class[] _defaultViews; - /** - * @since 2.9 - */ protected boolean _defaultViewsResolved; /* @@ -579,22 +572,6 @@ protected boolean isFactoryMethod(AnnotatedMethod am) return false; } - /** - * @deprecated since 2.8 - */ - @Deprecated // since 2.8, not used at least since 2.7 - protected PropertyName _findCreatorPropertyName(AnnotatedParameter param) - { - PropertyName name = _annotationIntrospector.findNameForDeserialization(param); - if (name == null || name.isEmpty()) { - String str = _annotationIntrospector.findImplicitPropertyName(param); - if (str != null && !str.isEmpty()) { - name = PropertyName.construct(str); - } - } - return name; - } - /* /********************************************************** /* Introspection for deserialization, other @@ -629,44 +606,6 @@ public String findClassDescription() { null : _annotationIntrospector.findClassDescription(_classInfo); } - /* - /********************************************************** - /* Helper methods for field introspection - /********************************************************** - */ - - /** - * @param ignoredProperties (optional) names of properties to ignore; - * any fields that would be recognized as one of these properties - * is ignored. - * @param forSerialization If true, will collect serializable property - * fields; if false, deserializable - * - * @return Ordered Map with logical property name as key, and - * matching field as value. - * - * @deprecated Since 2.7.2, does not seem to be used? - */ - @Deprecated - public LinkedHashMap _findPropertyFields( - Collection ignoredProperties, boolean forSerialization) - { - LinkedHashMap results = new LinkedHashMap(); - for (BeanPropertyDefinition property : _properties()) { - AnnotatedField f = property.getField(); - if (f != null) { - String name = property.getName(); - if (ignoredProperties != null) { - if (ignoredProperties.contains(name)) { - continue; - } - } - results.put(name, f); - } - } - return results; - } - /* /********************************************************** /* Helper methods, other diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java b/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java index cfdb068f57..408a0da24c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/JacksonAnnotationIntrospector.java @@ -130,8 +130,6 @@ protected Object readResolve() { * without explicit use of JsonCreator annotation. *

    * Default setting is `true` - * - * @since 2.7.4 */ public JacksonAnnotationIntrospector setConstructorPropertiesImpliesCreator(boolean b) { @@ -644,31 +642,6 @@ public JsonInclude.Value findPropertyInclusion(Annotated a) { JsonInclude inc = _findAnnotation(a, JsonInclude.class); JsonInclude.Value value = (inc == null) ? JsonInclude.Value.empty() : JsonInclude.Value.from(inc); - - // only consider deprecated variant if we didn't have non-deprecated one: - if (value.getValueInclusion() == JsonInclude.Include.USE_DEFAULTS) { - value = _refinePropertyInclusion(a, value); - } - return value; - } - - @SuppressWarnings("deprecation") - private JsonInclude.Value _refinePropertyInclusion(Annotated a, JsonInclude.Value value) { - JsonSerialize ann = _findAnnotation(a, JsonSerialize.class); - if (ann != null) { - switch (ann.include()) { - case ALWAYS: - return value.withValueInclusion(JsonInclude.Include.ALWAYS); - case NON_NULL: - return value.withValueInclusion(JsonInclude.Include.NON_NULL); - case NON_DEFAULT: - return value.withValueInclusion(JsonInclude.Include.NON_DEFAULT); - case NON_EMPTY: - return value.withValueInclusion(JsonInclude.Include.NON_EMPTY); - case DEFAULT_INCLUSION: - default: - } - } return value; } diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSchema.java b/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSchema.java deleted file mode 100644 index f442be42a3..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSchema.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.fasterxml.jackson.databind.jsonschema; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; - -/** - * Container for a logical JSON Schema instance. - * Internally schema data is stored as a JSON Tree - * (instance of {@link JsonNode} is the root - * of schema document) - * - * @author Ryan Heaton - * @see JSON Schema - * - * @deprecated Since 2.2, we recommend use of external - * JSON Schema generator module - */ -@Deprecated -public class JsonSchema -{ - private final ObjectNode schema; - - /** - * Main constructor for schema instances. - *

    - * This is the creator constructor used by Jackson itself when - * deserializing instances. It is so-called delegating creator, - * meaning that its argument will be bound by Jackson before - * constructor gets called. - */ - @JsonCreator - public JsonSchema(ObjectNode schema) - { - this.schema = schema; - } - - /** - * Method for accessing root JSON object of the contained schema. - *

    - * Note: this method is specified with {@link JsonValue} annotation - * to represent serialization to use; same as if explicitly - * serializing returned object. - * - * @return Root node of the schema tree - */ - @JsonValue - public ObjectNode getSchemaNode() - { - return schema; - } - - @Override - public String toString() - { - return this.schema.toString(); - } - - @Override - public int hashCode() - { - return schema.hashCode(); - } - - @Override - public boolean equals(Object o) - { - if (o == this) return true; - if (o == null) return false; - if (!(o instanceof JsonSchema)) return false; - - JsonSchema other = (JsonSchema) o; - if (schema == null) { - return other.schema == null; - } - return schema.equals(other.schema); - } - - /** - * Get the default schema node. - * - * @return The default schema node. - */ - public static JsonNode getDefaultSchemaNode() - { - ObjectNode objectNode = JsonNodeFactory.instance.objectNode(); - objectNode.put("type", "any"); - // "required" is false by default, no need to include - //objectNode.put("required", false); - return objectNode; - } - -} diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java b/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java deleted file mode 100644 index b34ce6d355..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.fasterxml.jackson.databind.jsonschema; - -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Retention; -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -import com.fasterxml.jackson.annotation.JacksonAnnotation; - -/** - * Annotation that can be used to define JSON Schema definition for - * the annotated class. - *

    - * Note that annotation is often not needed: for example, regular - * Jackson beans that Jackson can introspect can be used without - * annotations, to produce JSON schema definition. - * - * @author Ryan Heaton - * @author Tatu Saloranta - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@JacksonAnnotation -public @interface JsonSerializableSchema -{ - /** - * Marker value used to indicate that property has "no value"; - * needed because annotations cannot have null as default - * value. - */ - public final static String NO_VALUE = "##irrelevant"; - - /** - * Property that can be used to indicate id of the type when - * generating JSON Schema; empty String indicates that no id - * is defined. - */ - public String id() default ""; - - /** - * The schema type for this JsonSerializable instance. - * Possible values: "string", "number", "boolean", "object", "array", "null", "any" - * - * @return The schema type for this JsonSerializable instance. - */ - public String schemaType() default "any"; - - /** - * If the schema type is "object", JSON definition of properties of the object as - * a String. - * - * @return The node representing the schema properties, or "##irrelevant" if irrelevant. - * - * @deprecated (since 2.1) -- support will be dropped in future, since JSON-as-String is - * fundamentally bad way for customizing anything. No direct replacements offered. - */ - @Deprecated - public String schemaObjectPropertiesDefinition() default NO_VALUE; - - /** - * If the schema type if "array", JSON definition of the schema for item types contained. - * - * @return The schema for the items in the array, or "##irrelevant" if irrelevant. - * - * @deprecated (since 2.1) -- support will be dropped in future, since JSON-as-String is - * fundamentally bad way for customizing anything. No direct replacements offered. - */ - @Deprecated - public String schemaItemDefinition() default NO_VALUE; -} diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java b/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java deleted file mode 100644 index f3505cd37d..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.fasterxml.jackson.databind.jsonschema; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.SerializerProvider; - -import java.lang.reflect.Type; - -/** - * Marker interface for schema-aware serializers. - */ -public interface SchemaAware -{ - /** - * Get the representation of the schema to which this serializer will conform. - * - * @param provider The serializer provider. - * @param typeHint A hint about the type. - * @return Json-schema for this serializer. - */ - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - throws JsonMappingException; - - /** - * Get the representation of the schema to which this serializer will conform. - * - * @param provider The serializer provider. - * @param isOptional Is the type optional - * @param typeHint A hint about the type. - * @return Json-schema for this serializer. - */ - public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) - throws JsonMappingException; -} diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonschema/package-info.java b/src/main/java/com/fasterxml/jackson/databind/jsonschema/package-info.java deleted file mode 100644 index 443dcf48f9..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/jsonschema/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Classes needed for JSON schema support (currently just ability - * to generate schemas using serialization part of data mapping) - */ -package com.fasterxml.jackson.databind.jsonschema; diff --git a/src/main/java/com/fasterxml/jackson/databind/jsontype/SubtypeResolver.java b/src/main/java/com/fasterxml/jackson/databind/jsontype/SubtypeResolver.java index 0f6c50b6ee..ab50a208a1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/jsontype/SubtypeResolver.java +++ b/src/main/java/com/fasterxml/jackson/databind/jsontype/SubtypeResolver.java @@ -2,7 +2,6 @@ import java.util.Collection; -import com.fasterxml.jackson.databind.AnnotationIntrospector; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.AnnotatedClass; @@ -29,9 +28,6 @@ public abstract class SubtypeResolver public abstract void registerSubtypes(Class... classes); - /** - * @since 2.9 - */ public abstract void registerSubtypes(Collection> subtypes); /* @@ -49,15 +45,9 @@ public abstract class SubtypeResolver * @param baseType Effective property base type to use; may differ from * actual type of property; for structured types it is content (value) type and NOT * structured type. - * - * @since 2.6 */ - public Collection collectAndResolveSubtypesByClass(MapperConfig config, - AnnotatedMember property, JavaType baseType) { - // for backwards compatibility... - return collectAndResolveSubtypes(property, config, - config.getAnnotationIntrospector(), baseType); - } + public abstract Collection collectAndResolveSubtypesByClass(MapperConfig config, + AnnotatedMember property, JavaType baseType); /** * Method for finding out all reachable subtypes for given type, @@ -67,14 +57,9 @@ public Collection collectAndResolveSubtypesByClass(MapperConfig co * @param baseType Effective property base type to use; may differ from * actual type of property; for structured types it is content (value) type and NOT * structured type. - * - * @since 2.6 */ - public Collection collectAndResolveSubtypesByClass(MapperConfig config, - AnnotatedClass baseType) { - // for backwards compatibility... - return collectAndResolveSubtypes(baseType, config, config.getAnnotationIntrospector()); - } + public abstract Collection collectAndResolveSubtypesByClass(MapperConfig config, + AnnotatedClass baseType); /** * Method for finding out all reachable subtypes for a property specified @@ -85,15 +70,9 @@ public Collection collectAndResolveSubtypesByClass(MapperConfig co * @param baseType Effective property base type to use; may differ from * actual type of property; for structured types it is content (value) type and NOT * structured type. - * - * @since 2.6 */ - public Collection collectAndResolveSubtypesByTypeId(MapperConfig config, - AnnotatedMember property, JavaType baseType) { - // for backwards compatibility... - return collectAndResolveSubtypes(property, config, - config.getAnnotationIntrospector(), baseType); - } + public abstract Collection collectAndResolveSubtypesByTypeId(MapperConfig config, + AnnotatedMember property, JavaType baseType); /** * Method for finding out all reachable subtypes for given type, @@ -103,42 +82,7 @@ public Collection collectAndResolveSubtypesByTypeId(MapperConfig c * @param baseType Effective property base type to use; may differ from * actual type of property; for structured types it is content (value) type and NOT * structured type. - * - * @since 2.6 - */ - public Collection collectAndResolveSubtypesByTypeId(MapperConfig config, - AnnotatedClass baseType) { - // for backwards compatibility... - return collectAndResolveSubtypes(baseType, config, config.getAnnotationIntrospector()); - } - - /* - /********************************************************** - /* Deprecated methods - /********************************************************** - */ - - /** - * @deprecated Since 2.6 Use either - * {@link #collectAndResolveSubtypesByClass(MapperConfig, AnnotatedMember, JavaType)} - * or {@link #collectAndResolveSubtypesByTypeId(MapperConfig, AnnotatedMember, JavaType)} - * instead. - */ - @Deprecated - public Collection collectAndResolveSubtypes(AnnotatedMember property, - MapperConfig config, AnnotationIntrospector ai, JavaType baseType) { - return collectAndResolveSubtypesByClass(config, property, baseType); - } - - /** - * @deprecated Since 2.6 Use either - * {@link #collectAndResolveSubtypesByClass(MapperConfig, AnnotatedClass)} - * or {@link #collectAndResolveSubtypesByTypeId(MapperConfig, AnnotatedClass)} - * instead. */ - @Deprecated - public Collection collectAndResolveSubtypes(AnnotatedClass baseType, - MapperConfig config, AnnotationIntrospector ai) { - return collectAndResolveSubtypesByClass(config, baseType); - } + public abstract Collection collectAndResolveSubtypesByTypeId(MapperConfig config, + AnnotatedClass baseType); } diff --git a/src/main/java/com/fasterxml/jackson/databind/jsontype/TypeSerializer.java b/src/main/java/com/fasterxml/jackson/databind/jsontype/TypeSerializer.java index d0d51d0f6f..b3c84342d3 100644 --- a/src/main/java/com/fasterxml/jackson/databind/jsontype/TypeSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/jsontype/TypeSerializer.java @@ -128,171 +128,13 @@ public WritableTypeId typeId(Object value, Class typeForId, public abstract WritableTypeId writeTypePrefix(JsonGenerator g, WritableTypeId typeId) throws IOException; - /** - * @since 2.9 - */ public abstract WritableTypeId writeTypeSuffix(JsonGenerator g, WritableTypeId typeId) throws IOException; - /* - /********************************************************** - /* Legacy type serialization methods - /********************************************************** - */ - - /** - * Method called to write initial part of type information for given - * value, when it will be output as scalar JSON value (not as JSON - * Object or Array). - * This means that the context after call cannot be that of JSON Object; - * it may be Array or root context. - * - * @param value Value that will be serialized, for which type information is - * to be written - * @param g Generator to use for writing type information - */ - @Deprecated // since 2.9 - public void writeTypePrefixForScalar(Object value, JsonGenerator g) throws IOException { - writeTypePrefix(g, typeId(value, JsonToken.VALUE_STRING)); - } - - /** - * Method called to write initial part of type information for given - * value, when it will be output as JSON Object value (not as JSON - * Array or scalar). - * This means that context after call must be JSON Object, meaning that - * caller can then proceed to output field entries. - * - * @param value Value that will be serialized, for which type information is - * to be written - * @param g Generator to use for writing type information - */ - @Deprecated // since 2.9 - public void writeTypePrefixForObject(Object value, JsonGenerator g) throws IOException { - writeTypePrefix(g, typeId(value, JsonToken.START_OBJECT)); - } - - /** - * Method called to write initial part of type information for given - * value, when it will be output as JSON Array value (not as JSON - * Object or scalar). - * This means that context after call must be JSON Array, that is, there - * must be an open START_ARRAY to write contents in. - * - * @param value Value that will be serialized, for which type information is - * to be written - * @param g Generator to use for writing type information - */ - @Deprecated // since 2.9 - public void writeTypePrefixForArray(Object value, JsonGenerator g) throws IOException { - writeTypePrefix(g, typeId(value, JsonToken.START_ARRAY)); - } - - /** - * Method called after value has been serialized, to close any scopes opened - * by earlier matching call to {@link #writeTypePrefixForScalar}. - * Actual action to take may depend on various factors, but has to match with - * action {@link #writeTypePrefixForScalar} did (close array or object; or do nothing). - */ - @Deprecated // since 2.9 - public void writeTypeSuffixForScalar(Object value, JsonGenerator g) throws IOException { - _writeLegacySuffix(g, typeId(value, JsonToken.VALUE_STRING)); - } - - /** - * Method called after value has been serialized, to close any scopes opened - * by earlier matching call to {@link #writeTypePrefixForObject}. - * It needs to write closing END_OBJECT marker, and any other decoration - * that needs to be matched. - */ - @Deprecated // since 2.9 - public void writeTypeSuffixForObject(Object value, JsonGenerator g) throws IOException { - _writeLegacySuffix(g, typeId(value, JsonToken.START_OBJECT)); - } - - /** - * Method called after value has been serialized, to close any scopes opened - * by earlier matching call to {@link #writeTypeSuffixForScalar}. - * It needs to write closing END_ARRAY marker, and any other decoration - * that needs to be matched. - */ - @Deprecated // since 2.9 - public void writeTypeSuffixForArray(Object value, JsonGenerator g) throws IOException { - _writeLegacySuffix(g, typeId(value, JsonToken.START_ARRAY)); - } - - /** - * Alternative version of the prefix-for-scalar method, which is given - * actual type to use (instead of using exact type of the value); typically - * a super type of actual value type - */ - @Deprecated // since 2.9 - public void writeTypePrefixForScalar(Object value, JsonGenerator g, Class type) throws IOException { - writeTypePrefix(g, typeId(value, type, JsonToken.VALUE_STRING)); - } - - /** - * Alternative version of the prefix-for-object method, which is given - * actual type to use (instead of using exact type of the value); typically - * a super type of actual value type - */ - @Deprecated // since 2.9 - public void writeTypePrefixForObject(Object value, JsonGenerator g, Class type) throws IOException { - writeTypePrefix(g, typeId(value, type, JsonToken.START_OBJECT)); - } - - /** - * Alternative version of the prefix-for-array method, which is given - * actual type to use (instead of using exact type of the value); typically - * a super type of actual value type - */ - @Deprecated // since 2.9 - public void writeTypePrefixForArray(Object value, JsonGenerator g, Class type) throws IOException { - writeTypePrefix(g, typeId(value, type, JsonToken.START_ARRAY)); - } - - /* - /********************************************************** - /* Type serialization methods with type id override - /********************************************************** - */ - - @Deprecated // since 2.9 - public void writeCustomTypePrefixForScalar(Object value, JsonGenerator g, String typeId) throws IOException { - writeTypePrefix(g, typeId(value, JsonToken.VALUE_STRING, typeId)); - } - - @Deprecated // since 2.9 - public void writeCustomTypePrefixForObject(Object value, JsonGenerator g, String typeId) throws IOException { - writeTypePrefix(g, typeId(value, JsonToken.START_OBJECT, typeId)); - } - - @Deprecated // since 2.9 - public void writeCustomTypePrefixForArray(Object value, JsonGenerator g, String typeId) throws IOException { - writeTypePrefix(g, typeId(value, JsonToken.START_ARRAY, typeId)); - } - - @Deprecated // since 2.9 - public void writeCustomTypeSuffixForScalar(Object value, JsonGenerator g, String typeId) throws IOException { - _writeLegacySuffix(g, typeId(value, JsonToken.VALUE_STRING, typeId)); - } - - @Deprecated // since 2.9 - public void writeCustomTypeSuffixForObject(Object value, JsonGenerator g, String typeId) throws IOException { - _writeLegacySuffix(g, typeId(value, JsonToken.START_OBJECT, typeId)); - } - - @Deprecated // since 2.9 - public void writeCustomTypeSuffixForArray(Object value, JsonGenerator g, String typeId) throws IOException { - _writeLegacySuffix(g, typeId(value, JsonToken.START_ARRAY, typeId)); - } - /** * Helper method needed for backwards compatibility: since original type id * can not be routed through completely, we have to reverse-engineer likely * setting before calling suffix. - * - * @since 2.9 */ protected final void _writeLegacySuffix(JsonGenerator g, WritableTypeId typeId) throws IOException diff --git a/src/main/java/com/fasterxml/jackson/databind/module/SimpleAbstractTypeResolver.java b/src/main/java/com/fasterxml/jackson/databind/module/SimpleAbstractTypeResolver.java index 3701950f5e..19ed7de404 100644 --- a/src/main/java/com/fasterxml/jackson/databind/module/SimpleAbstractTypeResolver.java +++ b/src/main/java/com/fasterxml/jackson/databind/module/SimpleAbstractTypeResolver.java @@ -80,13 +80,6 @@ public JavaType findTypeMapping(DeserializationConfig config, JavaType type) return config.getTypeFactory().constructSpecializedType(type, dst); } - @Override - @Deprecated - public JavaType resolveAbstractType(DeserializationConfig config, JavaType type){ - // never materialize anything, so: - return null; - } - @Override public JavaType resolveAbstractType(DeserializationConfig config, BeanDescription typeDesc) { diff --git a/src/main/java/com/fasterxml/jackson/databind/node/ArrayNode.java b/src/main/java/com/fasterxml/jackson/databind/node/ArrayNode.java index 1fb45a389c..b02e6dbf52 100644 --- a/src/main/java/com/fasterxml/jackson/databind/node/ArrayNode.java +++ b/src/main/java/com/fasterxml/jackson/databind/node/ArrayNode.java @@ -31,17 +31,11 @@ public ArrayNode(JsonNodeFactory nf) { _children = new ArrayList(); } - /** - * @since 2.8 - */ public ArrayNode(JsonNodeFactory nf, int capacity) { super(nf); _children = new ArrayList(capacity); } - /** - * @since 2.7 - */ public ArrayNode(JsonNodeFactory nf, List children) { super(nf); _children = children; diff --git a/src/main/java/com/fasterxml/jackson/databind/node/ObjectNode.java b/src/main/java/com/fasterxml/jackson/databind/node/ObjectNode.java index be6c268907..16c605a43d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/node/ObjectNode.java +++ b/src/main/java/com/fasterxml/jackson/databind/node/ObjectNode.java @@ -345,10 +345,7 @@ public void serializeWithType(JsonGenerator g, SerializerProvider provider, * Method that will set specified field, replacing old value, if any. * Note that this is identical to {@link #replace(String, JsonNode)}, * except for return value. - *

    - * NOTE: added to replace those uses of {@link #put(String, JsonNode)} - * where chaining with 'this' is desired. - * + * * @param value to set field to; if null, will be converted * to a {@link NullNode} first (to remove field entry, call * {@link #remove} instead) @@ -459,28 +456,7 @@ public ObjectNode without(Collection fieldNames) /* Extended ObjectNode API, mutators, generic /********************************************************** */ - - /** - * Method that will set specified field, replacing old value, if any. - * - * @param value to set field to; if null, will be converted - * to a {@link NullNode} first (to remove field entry, call - * {@link #remove} instead) - * - * @return Old value of the field, if any; null if there was no - * old value. - * - * @deprecated Since 2.4 use either {@link #set(String,JsonNode)} or {@link #replace(String,JsonNode)}, - */ - @Deprecated - public JsonNode put(String fieldName, JsonNode value) - { - if (value == null) { // let's not store 'raw' nulls but nodes - value = nullNode(); - } - return _children.put(fieldName, value); - } - + /** * Method for removing field entry from this ObjectNode. * Will return value of the field, if such field existed; @@ -519,36 +495,6 @@ public ObjectNode removeAll() return this; } - /** - * Method for adding given properties to this object node, overriding - * any existing values for those properties. - * - * @param properties Properties to add - * - * @return This node after adding/replacing property values (to allow chaining) - * - * @deprecated Since 2.4 use {@link #setAll(Map)}, - */ - @Deprecated - public JsonNode putAll(Map properties) { - return setAll(properties); - } - - /** - * Method for adding all properties of the given Object, overriding - * any existing values for those properties. - * - * @param other Object of which properties to add to this object - * - * @return This node (to allow chaining) - * - * @deprecated Since 2.4 use {@link #setAll(ObjectNode)}, - */ - @Deprecated - public JsonNode putAll(ObjectNode other) { - return setAll(other); - } - /** * Method for removing all field properties out of this ObjectNode * except for ones specified in argument. diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java index 0c09ae1566..354015843a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java @@ -796,7 +796,6 @@ protected JsonSerializer buildMapSerializer(SerializerProvider prov, * * @since 2.9 */ - @SuppressWarnings("deprecation") protected MapSerializer _checkMapContentInclusion(SerializerProvider prov, BeanDescription beanDesc, MapSerializer mapSer) throws JsonMappingException @@ -809,9 +808,6 @@ protected MapSerializer _checkMapContentInclusion(SerializerProvider prov, JsonInclude.Include incl = (inclV == null) ? JsonInclude.Include.USE_DEFAULTS : inclV.getContentInclusion(); if (incl == JsonInclude.Include.USE_DEFAULTS || incl == JsonInclude.Include.ALWAYS) { - if (!prov.isEnabled(SerializationFeature.WRITE_NULL_MAP_VALUES)) { - return mapSer.withContentInclusion(null, true); - } return mapSer; } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyFilter.java b/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyFilter.java deleted file mode 100644 index 1aa4acdcb0..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyFilter.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.fasterxml.jackson.databind.ser; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.node.ObjectNode; - -/** - * Interface that defines API for filter objects use (as configured - * using {@link com.fasterxml.jackson.annotation.JsonFilter}) - * for filtering bean properties to serialize. - *

    - * Starting with version 2.3 this class is deprecated; use - * {@link PropertyFilter} instead. - * - * @deprecated Since 2.3: use {@link PropertyFilter} instead. - */ -@Deprecated -public interface BeanPropertyFilter -{ - /** - * Method called by {@link BeanSerializer} to let filter decide what to do with - * given bean property value: the usual choices are to either filter out (i.e. - * do nothing) or write using given {@link BeanPropertyWriter}, although filters - * can choose other to do something different altogether. - *

    - * Typical implementation is something like: - *

    -     * if (include(writer)) {
    -     *      writer.serializeAsField(pojo, jgen, prov);
    -     * }
    -     *
    - * - * @param pojo Object that contains property value to serialize - * @param jgen Generator use for serializing value - * @param prov Provider that can be used for accessing dynamic aspects of serialization - * processing - * @param writer Default bean property serializer to use - */ - public void serializeAsField(Object pojo, JsonGenerator jgen, SerializerProvider prov, - BeanPropertyWriter writer) - throws Exception; - - /** - * Method called by {@link BeanSerializer} to let the filter determine whether, and in what - * form the given property exist within the parent, or root, schema. Filters can omit - * adding the property to the node, or choose the form of the schema value for the property. - *

    - * Typical implementation is something like: - *

    -     * if (include(writer)) {
    -     *      writer.depositSchemaProperty(propertiesNode, provider);
    -     * }
    -     *
    - * - * @param writer Bean property writer to use to create schema value - * @param propertiesNode Node which the given property would exist within - * @param provider Provider that can be used for accessing dynamic aspects of serialization - * processing - * - * @since 2.1 - * @deprecated Since 2.3: new code should use the alternative depositSchemaProperty - * method - */ - @Deprecated - public void depositSchemaProperty(BeanPropertyWriter writer, ObjectNode propertiesNode, - SerializerProvider provider) - throws JsonMappingException; - - /** - * Method called by {@link BeanSerializer} to let the filter determine whether, and in what - * form the given property exist within the parent, or root, schema. Filters can omit - * adding the property to the node, or choose the form of the schema value for the property - *

    - * Typical implementation is something like: - *

    -     * if (include(writer)) {
    -     *      writer.depositSchemaProperty(objectVisitor, provider);
    -     * }
    -     *
    - * - * @param writer Bean property serializer to use to create schema value - * @param objectVisitor JsonObjectFormatVisitor which should be aware of - * the property's existence - * @param provider Provider that can be used for accessing dynamic aspects of serialization - * processing - * - * @since 2.1 - */ - public void depositSchemaProperty(BeanPropertyWriter writer, JsonObjectFormatVisitor objectVisitor, - SerializerProvider provider) - throws JsonMappingException; -} diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyWriter.java b/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyWriter.java index 51cb1c2cb3..278f4c327c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyWriter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/BeanPropertyWriter.java @@ -3,18 +3,18 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.lang.reflect.Type; import java.util.HashMap; import com.fasterxml.jackson.annotation.JsonInclude; + import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.SerializableString; import com.fasterxml.jackson.core.io.SerializedString; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.introspect.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap; @@ -34,13 +34,11 @@ * this is to reduce likelihood of data corruption and synchronization issues. */ @JacksonStdImpl -// since 2.6. NOTE: sub-classes typically are not public class BeanPropertyWriter extends PropertyWriter // which extends // `ConcreteBeanPropertyBase` - implements java.io.Serializable // since 2.6 + implements java.io.Serializable { - // As of 2.7 - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 3L; /** * Marker object used to indicate "do not serialize if empty" @@ -66,8 +64,6 @@ public class BeanPropertyWriter extends PropertyWriter // which extends /** * Wrapper name to use for this element, if any - * - * @since 2.2 */ protected final PropertyName _wrapperName; @@ -247,24 +243,10 @@ public BeanPropertyWriter(BeanPropertyDefinition propDef, _includeInViews = includeInViews; } - @Deprecated // Since 2.9 - public BeanPropertyWriter(BeanPropertyDefinition propDef, - AnnotatedMember member, Annotations contextAnnotations, - JavaType declaredType, - JsonSerializer ser, TypeSerializer typeSer, JavaType serType, - boolean suppressNulls, Object suppressableValue) - { - this(propDef, member, contextAnnotations, declaredType, - ser, typeSer, serType, suppressNulls, suppressableValue, - null); - } - /** * Constructor that may be of use to virtual properties, when there is need * for the zero-arg ("default") constructor, and actual initialization is * done after constructor call. - * - * @since 2.5 */ protected BeanPropertyWriter() { super(PropertyMetadata.STD_REQUIRED_OR_OPTIONAL); @@ -627,44 +609,6 @@ public JavaType getSerializationType() { return _cfgSerializationType; } - @Deprecated // since 2.9 - public Class getRawSerializationType() { - return (_cfgSerializationType == null) ? null : _cfgSerializationType - .getRawClass(); - } - - /** - * @deprecated Since 2.7, to be removed from 2.9, use {@link #getType()} instead. - */ - @Deprecated - public Class getPropertyType() { - if (_accessorMethod != null) { - return _accessorMethod.getReturnType(); - } - if (_field != null) { - return _field.getType(); - } - return null; - } - - /** - * Get the generic property type of this property writer. - * - * @return The property type, or null if not found. - * - * @deprecated Since 2.7, to be removed from 2.9, use {@link #getType()} instead. - */ - @Deprecated - public Type getGenericPropertyType() { - if (_accessorMethod != null) { - return _accessorMethod.getGenericReturnType(); - } - if (_field != null) { - return _field.getGenericType(); - } - return null; - } - public Class[] getViews() { return _includeInViews; } @@ -841,44 +785,6 @@ public void depositSchemaProperty(JsonObjectFormatVisitor v, } } - // // // Legacy support for JsonFormatVisitable - - /** - * Attempt to add the output of the given {@link BeanPropertyWriter} in the - * given {@link ObjectNode}. Otherwise, add the default schema - * {@link JsonNode} in place of the writer's output - * - * @param propertiesNode - * Node which the given property would exist within - * @param provider - * Provider that can be used for accessing dynamic aspects of - * serialization processing - */ - @Override - @Deprecated - public void depositSchemaProperty(ObjectNode propertiesNode, - SerializerProvider provider) throws JsonMappingException { - JavaType propType = getSerializationType(); - // 03-Dec-2010, tatu: SchemaAware REALLY should use JavaType, but alas - // it doesn't... - Type hint = (propType == null) ? getType() : propType.getRawClass(); - JsonNode schemaNode; - // Maybe it already has annotated/statically configured serializer? - JsonSerializer ser = getSerializer(); - if (ser == null) { // nope - ser = provider.findValueSerializer(getType(), this); - } - boolean isOptional = !isRequired(); - if (ser instanceof SchemaAware) { - schemaNode = ((SchemaAware) ser).getSchema(provider, hint, - isOptional); - } else { - schemaNode = com.fasterxml.jackson.databind.jsonschema.JsonSchema - .getDefaultSchemaNode(); - } - _depositSchemaProperty(propertiesNode, schemaNode); - } - /* /********************************************************** /* Helper methods diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java index c7d4bea4ab..ea8ce9fd8f 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/ContainerSerializer.java @@ -25,9 +25,6 @@ protected ContainerSerializer(Class t) { super(t); } - /** - * @since 2.5 - */ protected ContainerSerializer(JavaType fullType) { super(fullType); } @@ -90,9 +87,8 @@ public ContainerSerializer withValueTypeSerializer(TypeSerializer vts) { /********************************************************** */ -// since 2.5: should be declared abstract in future (2.9?) -// @Override -// public abstract boolean isEmpty(SerializerProvider prov, T value); + @Override + public abstract boolean isEmpty(SerializerProvider prov, T value); /** * Method called to determine if the given value (of type handled by @@ -103,7 +99,7 @@ public ContainerSerializer withValueTypeSerializer(TypeSerializer vts) { * containers that do not keep track of size (like linked lists may * not). *

    - * Note, too, that as of now (2.9) this method is only called by serializer + * Note, too, that this method is only called by serializer * itself; and specifically is not used for non-array/collection types * like Map or Map.Entry instances. */ @@ -115,38 +111,4 @@ public ContainerSerializer withValueTypeSerializer(TypeSerializer vts) { * addition type information is to be embedded. */ protected abstract ContainerSerializer _withValueTypeSerializer(TypeSerializer vts); - - /* - /********************************************************** - /* Helper methods for sub-types - /********************************************************** - */ - - /** - * Helper method used to encapsulate logic for determining whether there is - * a property annotation that overrides element type; if so, we can - * and need to statically find the serializer. - * - * @since 2.1 - * - * @deprecated Since 2.7: should not be needed; should be enough to see if - * type has 'isStatic' modifier - */ - @Deprecated - protected boolean hasContentTypeAnnotation(SerializerProvider provider, - BeanProperty property) - { - /* - if (property != null) { - AnnotationIntrospector intr = provider.getAnnotationIntrospector(); - AnnotatedMember m = property.getMember(); - if ((m != null) && (intr != null)) { - if (intr.findSerializationContentType(m, property.getType()) != null) { - return true; - } - } - } - */ - return false; - } } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java b/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java index 549a256643..540119a2ab 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java @@ -11,9 +11,7 @@ import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; import com.fasterxml.jackson.databind.util.ClassUtil; @@ -566,33 +564,6 @@ public void acceptJsonFormatVisitor(JavaType javaType, JsonFormatVisitorWrapper findValueSerializer(javaType, null).acceptJsonFormatVisitor(visitor, javaType); } - /** - * The method to be called by {@link ObjectMapper} - * to generate JSON schema for - * given type. - * - * @param type The type for which to generate schema - * - * @deprecated Should not be used any more - */ - @Deprecated // since 2.6 - public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(Class type) - throws JsonMappingException - { - /* no need for embedded type information for JSON schema generation (all - * type information it needs is accessible via "untyped" serializer) - */ - JsonSerializer ser = findValueSerializer(type, null); - JsonNode schemaNode = (ser instanceof SchemaAware) ? - ((SchemaAware) ser).getSchema(this, null) : com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); - if (!(schemaNode instanceof ObjectNode)) { - throw new IllegalArgumentException("Class " + type.getName() - +" would not be serialized as a JSON object and therefore has no schema"); - } - return new com.fasterxml.jackson.databind.jsonschema.JsonSchema((ObjectNode) schemaNode); - } - - /* /********************************************************** /* Helper classes diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/FilterProvider.java b/src/main/java/com/fasterxml/jackson/databind/ser/FilterProvider.java index acd13c3625..b36bf7daa5 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/FilterProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/FilterProvider.java @@ -1,7 +1,5 @@ package com.fasterxml.jackson.databind.ser; -import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; - /** * Interface for objects that providers instances of {@link PropertyFilter} * that match given ids. A provider is configured to be used during serialization, @@ -10,28 +8,12 @@ */ public abstract class FilterProvider { - /** - * Lookup method used to find {@link BeanPropertyFilter} that has specified id. - * Note that id is typically a {@link java.lang.String}, but is not necessarily - * limited to that; that is, while standard components use String, custom - * implementation can choose other kinds of keys. - * - * @return Filter registered with specified id, if one defined; null if - * none found. - * - * @deprecated Since 2.3 deprecated because {@link BeanPropertyFilter} is deprecated; - */ - @Deprecated - public abstract BeanPropertyFilter findFilter(Object filterId); - /** * Lookup method used to find {@link PropertyFilter} that has specified id. * Note that id is typically a {@link java.lang.String}, but is not necessarily * limited to that; that is, while standard components use String, custom * implementation can choose other kinds of keys. *

    - * This method is the replacement for {@link #findFilter} starting with 2.3. - *

    * Note that the default implementation is designed to support short-term * backwards compatibility, and will call the deprecated findFilter * method, then wrap filter if one found as {@link PropertyFilter}. @@ -43,16 +25,6 @@ public abstract class FilterProvider * schemas. * * @return Filter to use, if any. - * - * @since 2.3 */ - public PropertyFilter findPropertyFilter(Object filterId, Object valueToFilter) - { - @SuppressWarnings("deprecation") - BeanPropertyFilter old = findFilter(filterId); - if (old == null) { - return null; - } - return SimpleBeanPropertyFilter.from(old); - } + public abstract PropertyFilter findPropertyFilter(Object filterId, Object valueToFilter); } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/PropertyFilter.java b/src/main/java/com/fasterxml/jackson/databind/ser/PropertyFilter.java index 89f32eff97..7538ece6a2 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/PropertyFilter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/PropertyFilter.java @@ -1,10 +1,10 @@ package com.fasterxml.jackson.databind.ser; import com.fasterxml.jackson.core.JsonGenerator; + import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.node.ObjectNode; /** * Interface that defines API for filter objects use (as configured @@ -71,32 +71,7 @@ public void serializeAsField(Object pojo, JsonGenerator gen, SerializerProvider public void serializeAsElement(Object elementValue, JsonGenerator gen, SerializerProvider prov, PropertyWriter writer) throws Exception; - - /** - * Method called by {@link BeanSerializer} to let the filter determine whether, and in what - * form the given property exist within the parent, or root, schema. Filters can omit - * adding the property to the node, or choose the form of the schema value for the property. - *

    - * Typical implementation is something like: - *

    -     * if (include(writer)) {
    -     *      writer.depositSchemaProperty(propertiesNode, provider);
    -     * }
    -     *
    - * - * @param writer Bean property writer to use to create schema value - * @param propertiesNode Node which the given property would exist within - * @param provider Provider that can be used for accessing dynamic aspects of serialization - * processing - * - * @deprecated Since 2.3: new code should use the alternative depositSchemaProperty - * method - */ - @Deprecated - public void depositSchemaProperty(PropertyWriter writer, ObjectNode propertiesNode, - SerializerProvider provider) - throws JsonMappingException; - + /** * Method called by {@link BeanSerializer} to let the filter determine whether, and in what * form the given property exist within the parent, or root, schema. Filters can omit diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/PropertyWriter.java b/src/main/java/com/fasterxml/jackson/databind/ser/PropertyWriter.java index 9d7a7a465f..d319f7f01d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/PropertyWriter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/PropertyWriter.java @@ -3,22 +3,20 @@ import java.lang.annotation.Annotation; import com.fasterxml.jackson.core.JsonGenerator; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.node.ObjectNode; /** * Base class for writers used to output property values (name-value pairs) * as key/value pairs via streaming API. This is the most generic abstraction * implemented by both POJO and {@link java.util.Map} serializers, and invoked * by filtering functionality. - * - * @since 2.3 */ public abstract class PropertyWriter - extends ConcreteBeanPropertyBase // since 2.7 + extends ConcreteBeanPropertyBase implements java.io.Serializable { private static final long serialVersionUID = 1L; @@ -155,13 +153,4 @@ public abstract void serializeAsPlaceholder(Object value, JsonGenerator jgen, Se public abstract void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException; - - /** - * Legacy method called for JSON Schema generation; should not be called by new code - * - * @deprecated Since 2.2 - */ - @Deprecated - public abstract void depositSchemaProperty(ObjectNode propertiesNode, SerializerProvider provider) - throws JsonMappingException; } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/FailingSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/FailingSerializer.java index 6021fa89e0..1ffd836986 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/FailingSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/FailingSerializer.java @@ -1,12 +1,10 @@ package com.fasterxml.jackson.databind.ser.impl; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.ser.std.StdSerializer; @@ -36,13 +34,7 @@ public void serialize(Object value, JsonGenerator g, SerializerProvider provider } @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - return null; - } - - @Override - public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) - { + public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) { ; } } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleBeanPropertyFilter.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleBeanPropertyFilter.java index df10cc2215..86c3070e65 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleBeanPropertyFilter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleBeanPropertyFilter.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.ser.*; @@ -17,9 +16,8 @@ * because it can provide default implementation for any methods that may * be added in {@link PropertyFilter} (as unfortunate as additions may be). */ -@SuppressWarnings("deprecation") public class SimpleBeanPropertyFilter - implements BeanPropertyFilter, PropertyFilter + implements PropertyFilter // sub-classes must also implement java.io.Serializable { /* @@ -77,47 +75,6 @@ public static SimpleBeanPropertyFilter serializeAllExcept(String... propertyArra return new SerializeExceptFilter(properties); } - /** - * Helper method to ease transition from {@link BeanPropertyWriter} into - * {@link PropertyWriter} - * - * @since 2.3 - */ - public static PropertyFilter from(final BeanPropertyFilter src) - { - return new PropertyFilter() { - @Override - public void serializeAsField(Object pojo, JsonGenerator jgen, - SerializerProvider prov, PropertyWriter writer) - throws Exception { - src.serializeAsField(pojo, jgen, prov, (BeanPropertyWriter) writer); - } - - @Override - public void depositSchemaProperty(PropertyWriter writer, - ObjectNode propertiesNode, SerializerProvider provider) - throws JsonMappingException { - src.depositSchemaProperty((BeanPropertyWriter) writer, propertiesNode, provider); - } - - @Override - public void depositSchemaProperty(PropertyWriter writer, - JsonObjectFormatVisitor objectVisitor, - SerializerProvider provider) throws JsonMappingException { - src.depositSchemaProperty((BeanPropertyWriter) writer, objectVisitor, provider); - } - - @Override - public void serializeAsElement(Object elementValue, - JsonGenerator jgen, SerializerProvider prov, - PropertyWriter writer) throws Exception { - // not needed; element filtering only available through new interfaces - throw new UnsupportedOperationException(); - } - - }; - } - /* /********************************************************** /* Methods for sub-classes @@ -152,46 +109,6 @@ protected boolean include(PropertyWriter writer) { protected boolean includeElement(Object elementValue) { return true; } - - /* - /********************************************************** - /* BeanPropertyFilter (deprecated) implementation - /********************************************************** - */ - - @Deprecated - @Override - public void serializeAsField(Object bean, JsonGenerator jgen, - SerializerProvider provider, BeanPropertyWriter writer) throws Exception - { - if (include(writer)) { - writer.serializeAsField(bean, jgen, provider); - } else if (!jgen.canOmitFields()) { // since 2.3 - writer.serializeAsOmittedField(bean, jgen, provider); - } - } - - @Deprecated - @Override - public void depositSchemaProperty(BeanPropertyWriter writer, - ObjectNode propertiesNode, SerializerProvider provider) - throws JsonMappingException - { - if (include(writer)) { - writer.depositSchemaProperty(propertiesNode, provider); - } - } - - @Deprecated - @Override - public void depositSchemaProperty(BeanPropertyWriter writer, - JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) - throws JsonMappingException - { - if (include(writer)) { - writer.depositSchemaProperty(objectVisitor, provider); - } - } /* /********************************************************** @@ -220,17 +137,6 @@ public void serializeAsElement(Object elementValue, JsonGenerator jgen, Serializ writer.serializeAsElement(elementValue, jgen, provider); } } - - @Deprecated - @Override - public void depositSchemaProperty(PropertyWriter writer, - ObjectNode propertiesNode, SerializerProvider provider) - throws JsonMappingException - { - if (include(writer)) { - writer.depositSchemaProperty(propertiesNode, provider); - } - } @Override public void depositSchemaProperty(PropertyWriter writer, diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleFilterProvider.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleFilterProvider.java index 52f6703fbd..97da3179b6 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleFilterProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/SimpleFilterProvider.java @@ -67,7 +67,6 @@ public SimpleFilterProvider(Map mapping) _filtersById = (Map) mapping; } - @SuppressWarnings("deprecation") private final static Map _convert(Map filters) { HashMap result = new HashMap(); @@ -75,8 +74,6 @@ private final static Map _convert(Map filters) Object f = entry.getValue(); if (f instanceof PropertyFilter) { result.put(entry.getKey(), (PropertyFilter) f); - } else if (f instanceof BeanPropertyFilter) { - result.put(entry.getKey(), _convert((BeanPropertyFilter) f)); } else { throw new IllegalArgumentException("Unrecognized filter type ("+f.getClass().getName()+")"); } @@ -84,26 +81,6 @@ private final static Map _convert(Map filters) return result; } - @SuppressWarnings("deprecation") - private final static PropertyFilter _convert(BeanPropertyFilter f) { - return SimpleBeanPropertyFilter.from((BeanPropertyFilter) f); - } - - /** - * Method for defining filter to return for "unknown" filters; cases - * where there is no mapping from given id to an explicit filter. - * - * @param f Filter to return when no filter is found for given id - * - * @deprecated Since 2.3 should use {@link PropertyFilter} instead of {@link BeanPropertyFilter} - */ - @Deprecated - public SimpleFilterProvider setDefaultFilter(BeanPropertyFilter f) - { - _defaultFilter = SimpleBeanPropertyFilter.from(f); - return this; - } - public SimpleFilterProvider setDefaultFilter(PropertyFilter f) { _defaultFilter = f; @@ -131,16 +108,6 @@ public SimpleFilterProvider setFailOnUnknownId(boolean state) { public boolean willFailOnUnknownId() { return _cfgFailOnUnknownId; } - - /** - * @deprecated since 2.3 - */ - @Deprecated - public SimpleFilterProvider addFilter(String id, BeanPropertyFilter filter) { - _filtersById.put(id, _convert(filter)); - return this; - } - public SimpleFilterProvider addFilter(String id, PropertyFilter filter) { _filtersById.put(id, filter); return this; @@ -164,13 +131,6 @@ public PropertyFilter removeFilter(String id) { /********************************************************** */ - @Deprecated // since 2.3 - @Override - public BeanPropertyFilter findFilter(Object filterId) - { - throw new UnsupportedOperationException("Access to deprecated filters not supported"); - } - @Override public PropertyFilter findPropertyFilter(Object filterId, Object valueToFilter) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java index 1011babe52..3337189702 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.impl; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.core.JsonGenerator; @@ -207,11 +206,6 @@ private void serializeContentsSlow(String[] value, JsonGenerator gen, Serializer } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("array", true).set("items", createSchemaNode("string")); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/UnknownSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/UnknownSerializer.java index 70b53e0634..826861f29c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/UnknownSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/UnknownSerializer.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.impl; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; @@ -54,11 +53,6 @@ public boolean isEmpty(SerializerProvider provider, Object value) { return true; } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - return null; - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java index ba1665ae4c..68f1643d65 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.annotation.JsonFormat; @@ -10,9 +9,7 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.ContainerSerializer; import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap; @@ -265,25 +262,6 @@ public void serializeWithType(T value, JsonGenerator g, SerializerProvider provi protected abstract void serializeContents(T value, JsonGenerator gen, SerializerProvider provider) throws IOException; - @SuppressWarnings("deprecation") - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - throws JsonMappingException - { - ObjectNode o = createSchemaNode("array", true); - if (_elementSerializer != null) { - JsonNode schemaNode = null; - if (_elementSerializer instanceof SchemaAware) { - schemaNode = ((SchemaAware) _elementSerializer).getSchema(provider, null); - } - if (schemaNode == null) { - schemaNode = com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); - } - o.set("items", schemaNode); - } - return o; - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java index a95d812038..e0dab5d81e 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java @@ -1,22 +1,20 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.util.*; import com.fasterxml.jackson.annotation.*; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.ObjectIdInfo; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.*; import com.fasterxml.jackson.databind.ser.impl.MapEntrySerializer; import com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter; @@ -36,7 +34,7 @@ public abstract class BeanSerializerBase extends StdSerializer implements ContextualSerializer, ResolvableSerializer, - JsonFormatVisitable, SchemaAware + JsonFormatVisitable { protected final static PropertyName NAME_FOR_OBJECT_REF = new PropertyName("#object-ref"); @@ -787,45 +785,6 @@ protected void serializeFieldsFiltered(Object bean, JsonGenerator gen, } } - @Deprecated - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - throws JsonMappingException - { - ObjectNode o = createSchemaNode("object", true); - // [JACKSON-813]: Add optional JSON Schema id attribute, if found - // NOTE: not optimal, does NOT go through AnnotationIntrospector etc: - JsonSerializableSchema ann = _handledType.getAnnotation(JsonSerializableSchema.class); - if (ann != null) { - String id = ann.id(); - if (id != null && id.length() > 0) { - o.put("id", id); - } - } - - //todo: should the classname go in the title? - //o.put("title", _className); - ObjectNode propertiesNode = o.objectNode(); - final PropertyFilter filter; - if (_propertyFilterId != null) { - filter = findPropertyFilter(provider, _propertyFilterId, null); - } else { - filter = null; - } - - for (int i = 0; i < _props.length; i++) { - BeanPropertyWriter prop = _props[i]; - if (filter == null) { - prop.depositSchemaProperty(propertiesNode, provider); - } else { - filter.depositSchemaProperty(prop, propertiesNode, provider); - } - - } - o.set("properties", propertiesNode); - return o; - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java index 9aaff5fac8..281ed93e24 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.core.JsonGenerator; @@ -9,7 +8,6 @@ import com.fasterxml.jackson.databind.BeanProperty; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; @@ -26,7 +24,6 @@ */ @JacksonStdImpl public final class BooleanSerializer -//In 2.9, removed use of intermediate type `NonTypedScalarSerializerBase` extends StdScalarSerializer implements ContextualSerializer { @@ -70,11 +67,6 @@ public final void serializeWithType(Object value, JsonGenerator g, SerializerPro g.writeBoolean(Boolean.TRUE.equals(value)); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("boolean", !_forPrimitive); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitor.expectBooleanFormat(typeHint); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java index 69c2ae602f..976a497a40 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java @@ -1,21 +1,18 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.node.ObjectNode; /** * Unlike other integral number array serializers, we do not just print out byte values @@ -69,14 +66,6 @@ public void serializeWithType(byte[] value, JsonGenerator g, SerializerProvider */ } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - ObjectNode o = createSchemaNode("array", true); - ObjectNode itemSchema = createSchemaNode("byte"); //binary values written as strings? - return o.set("items", itemSchema); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java index 6dfffcf80b..801f71ab9f 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java @@ -1,13 +1,11 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; @@ -27,12 +25,6 @@ public void serialize(Class value, JsonGenerator g, SerializerProvider provid g.writeString(value.getName()); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java index 5b5d5d09f1..6402f1a395 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -149,12 +148,6 @@ public boolean isEmpty(SerializerProvider serializers, T value) { protected abstract long _timestamp(T value); - @Override - public JsonNode getSchema(SerializerProvider serializers, Type typeHint) { - //todo: (ryan) add a format for the date in the schema? - return createSchemaNode(_asTimestamp(serializers) ? "number" : "string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java index def97ee4fa..2f3ee73c52 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.util.*; import com.fasterxml.jackson.annotation.JsonFormat; @@ -13,8 +12,6 @@ import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.util.EnumValues; @@ -138,25 +135,6 @@ public final void serialize(Enum en, JsonGenerator gen, SerializerProvider se /********************************************************** */ - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - if (_serializeAsIndex(provider)) { - return createSchemaNode("integer", true); - } - ObjectNode objectNode = createSchemaNode("string", true); - if (typeHint != null) { - JavaType type = provider.constructType(typeHint); - if (type.isEnumType()) { - ArrayNode enumNode = objectNode.putArray("enum"); - for (SerializableString value : _values.values()) { - enumNode.add(value.getValue()); - } - } - } - return objectNode; - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java index 696348aba7..11e298ce76 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java @@ -2,12 +2,10 @@ import java.io.File; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; @@ -26,11 +24,6 @@ public void serialize(File value, JsonGenerator g, SerializerProvider provider) g.writeString(value.getAbsolutePath()); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java index e753c794e3..516b3131ae 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java @@ -2,7 +2,6 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Type; import java.util.LinkedHashSet; import java.util.Set; @@ -15,7 +14,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeIdResolver; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.BeanSerializer; @@ -38,7 +36,7 @@ @JacksonStdImpl public class JsonValueSerializer extends StdSerializer - implements ContextualSerializer, JsonFormatVisitable, SchemaAware + implements ContextualSerializer, JsonFormatVisitable { /** * @since 2.9 @@ -222,17 +220,6 @@ public void serializeWithType(Object bean, JsonGenerator gen, SerializerProvider wrapAndThrow(provider, e, bean, _accessor.getName() + "()"); } } - - @SuppressWarnings("deprecation") - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - throws JsonMappingException - { - if (_valueSerializer instanceof SchemaAware) { - return ((SchemaAware)_valueSerializer).getSchema(provider, null); - } - return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); - } @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) @@ -371,9 +358,7 @@ public TypeIdResolver getTypeIdResolver() { return _typeSerializer.getTypeIdResolver(); } - // // // New Write API, 2.9+ - - @Override // since 2.9 + @Override public WritableTypeId writeTypePrefix(JsonGenerator g, WritableTypeId typeId) throws IOException { // 28-Jun-2017, tatu: Important! Need to "override" value @@ -381,110 +366,11 @@ public WritableTypeId writeTypePrefix(JsonGenerator g, return _typeSerializer.writeTypePrefix(g, typeId); } - @Override // since 2.9 + @Override public WritableTypeId writeTypeSuffix(JsonGenerator g, WritableTypeId typeId) throws IOException { // NOTE: already overwrote value object so: return _typeSerializer.writeTypeSuffix(g, typeId); } - - // // // Old Write API, pre-2.9 - - @Override - @Deprecated - public void writeTypePrefixForScalar(Object value, JsonGenerator gen) throws IOException { - _typeSerializer.writeTypePrefixForScalar(_forObject, gen); - } - - @Override - @Deprecated - public void writeTypePrefixForObject(Object value, JsonGenerator gen) throws IOException { - _typeSerializer.writeTypePrefixForObject(_forObject, gen); - } - - @Override - @Deprecated - public void writeTypePrefixForArray(Object value, JsonGenerator gen) throws IOException { - _typeSerializer.writeTypePrefixForArray(_forObject, gen); - } - - @Override - @Deprecated - public void writeTypeSuffixForScalar(Object value, JsonGenerator gen) throws IOException { - _typeSerializer.writeTypeSuffixForScalar(_forObject, gen); - } - - @Override - @Deprecated - public void writeTypeSuffixForObject(Object value, JsonGenerator gen) throws IOException { - _typeSerializer.writeTypeSuffixForObject(_forObject, gen); - } - - @Override - @Deprecated - public void writeTypeSuffixForArray(Object value, JsonGenerator gen) throws IOException { - _typeSerializer.writeTypeSuffixForArray(_forObject, gen); - } - - @Override - @Deprecated - public void writeTypePrefixForScalar(Object value, JsonGenerator gen, Class type) throws IOException { - _typeSerializer.writeTypePrefixForScalar(_forObject, gen, type); - } - - @Override - @Deprecated - public void writeTypePrefixForObject(Object value, JsonGenerator gen, Class type) throws IOException { - _typeSerializer.writeTypePrefixForObject(_forObject, gen, type); - } - - @Override - @Deprecated - public void writeTypePrefixForArray(Object value, JsonGenerator gen, Class type) throws IOException { - _typeSerializer.writeTypePrefixForArray(_forObject, gen, type); - } - - /* - /********************************************************** - /* Deprecated methods (since 2.9) - /********************************************************** - */ - - @Override - @Deprecated - public void writeCustomTypePrefixForScalar(Object value, JsonGenerator gen, String typeId) - throws IOException { - _typeSerializer.writeCustomTypePrefixForScalar(_forObject, gen, typeId); - } - - @Override - @Deprecated - public void writeCustomTypePrefixForObject(Object value, JsonGenerator gen, String typeId) throws IOException { - _typeSerializer.writeCustomTypePrefixForObject(_forObject, gen, typeId); - } - - @Override - @Deprecated - public void writeCustomTypePrefixForArray(Object value, JsonGenerator gen, String typeId) throws IOException { - _typeSerializer.writeCustomTypePrefixForArray(_forObject, gen, typeId); - } - - @Override - @Deprecated - public void writeCustomTypeSuffixForScalar(Object value, JsonGenerator gen, String typeId) throws IOException { - _typeSerializer.writeCustomTypeSuffixForScalar(_forObject, gen, typeId); - } - - @Override - @Deprecated - public void writeCustomTypeSuffixForObject(Object value, JsonGenerator gen, String typeId) throws IOException { - _typeSerializer.writeCustomTypeSuffixForObject(_forObject, gen, typeId); - } - - @Override - @Deprecated - public void writeCustomTypeSuffixForArray(Object value, JsonGenerator gen, String typeId) throws IOException { - _typeSerializer.writeCustomTypeSuffixForArray(_forObject, gen, typeId); - } } } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapProperty.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapProperty.java index c6ee24725c..7a7f7d313a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapProperty.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.PropertyWriter; /** @@ -151,13 +150,6 @@ public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, _property.depositSchemaProperty(objectVisitor, provider); } - @Override - @Deprecated - public void depositSchemaProperty(ObjectNode propertiesNode, - SerializerProvider provider) throws JsonMappingException { - // nothing to do here - } - @Override public JavaType getType() { return _property.getType(); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java index b4d6bb9e6c..8521a5fc73 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java @@ -1,14 +1,15 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.util.*; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; + import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; @@ -324,62 +325,10 @@ public static MapSerializer construct(Set ignoredEntries, JavaType mapTy return ser; } - /** - * @since 2.9 - */ protected void _ensureOverride(String method) { ClassUtil.verifyMustOverride(MapSerializer.class, this, method); } - /** - * @since 2.5 - */ - @Deprecated // since 2.9 - protected void _ensureOverride() { - _ensureOverride("N/A"); - } - - /* - /********************************************************** - /* Deprecated creators - /********************************************************** - */ - - /** - * @since 2.5 - * @deprecated // since 2.9 - */ - @Deprecated // since 2.9 - protected MapSerializer(MapSerializer src, TypeSerializer vts, - Object suppressableValue) - { - this(src, vts, suppressableValue, false); - } - - /** - * @deprecated since 2.9 - */ - @Deprecated // since 2.9 - public MapSerializer withContentInclusion(Object suppressableValue) { - return new MapSerializer(this, _valueTypeSerializer, suppressableValue, _suppressNulls); - } - - /** - * @since 2.3 - * - * @deprecated Since 2.8 use the other overload - */ - @Deprecated // since 2.8 - public static MapSerializer construct(String[] ignoredList, JavaType mapType, - boolean staticValueType, TypeSerializer vts, - JsonSerializer keySerializer, JsonSerializer valueSerializer, - Object filterId) - { - Set ignoredEntries = ArrayBuilders.arrayToSet(ignoredList); - return construct(ignoredEntries, mapType, staticValueType, vts, - keySerializer, valueSerializer, filterId); - } - /* /********************************************************** /* Post-processing (contextualization) @@ -1007,14 +956,6 @@ public void serializeFilteredAnyProperties(SerializerProvider provider, JsonGene /********************************************************** */ - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - // even though it's possible to statically determine the "value" type of the map, - // there's no way to statically determine the keys, so the "Entries" can't be determined. - return createSchemaNode("object", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java index e7e8a2f234..db340efb2a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java @@ -1,6 +1,5 @@ package com.fasterxml.jackson.databind.ser.std; -import java.lang.reflect.Type; import java.io.IOException; import com.fasterxml.jackson.core.*; @@ -43,12 +42,7 @@ public void serializeWithType(Object value, JsonGenerator gen, SerializerProvide { gen.writeNull(); } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - return createSchemaNode("null"); - } - + @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitor.expectNullFormat(typeHint); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java index 4e57a2ad85..8dea32ce61 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; @@ -62,11 +61,6 @@ public void serialize(Number value, JsonGenerator g, SerializerProvider provider } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode(_isInt ? "integer" : "number", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java index e27722ca23..3cca59b101 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.util.Map; import com.fasterxml.jackson.annotation.JsonFormat; @@ -62,11 +61,6 @@ protected Base(Class cls, JsonParser.NumberType numberType, || (numberType == JsonParser.NumberType.BIG_INTEGER); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode(_schemaType, true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java index bed8e7a998..2ef7a794c0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java @@ -1,6 +1,5 @@ package com.fasterxml.jackson.databind.ser.std; -import java.lang.reflect.Type; import java.io.IOException; import com.fasterxml.jackson.core.*; @@ -41,14 +40,7 @@ public void serializeWithType(T value, JsonGenerator g, SerializerProvider provi serialize(value, g, provider); typeSer.writeTypeSuffix(g, typeIdDef); } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - // type not really known, but since it is a JSON string: - return createSchemaNode("string", true); - } - + @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java index ba49c76b4f..a6f29dab68 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; @@ -22,11 +21,6 @@ public void serialize(java.sql.Time value, JsonGenerator g, SerializerProvider p g.writeString(value.toString()); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java index 84ac2bad3d..eb9b3e8b29 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.util.*; import com.fasterxml.jackson.annotation.JsonFormat; @@ -103,11 +102,6 @@ public boolean isEmpty(SerializerProvider provider, T value) { return (value == null) || (value.size() == 0); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("array", true).set("items", contentSchema()); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { acceptContentVisitor(visitor.expectArrayFormat(typeHint)); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java index eb05fa4b52..954f0fae1d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java @@ -1,17 +1,16 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import java.util.HashMap; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.ContainerSerializer; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -156,14 +155,6 @@ public void serializeContents(boolean[] value, JsonGenerator g, SerializerProvid } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - ObjectNode o = createSchemaNode("array", true); - o.set("items", createSchemaNode("boolean")); - return o; - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException @@ -235,14 +226,6 @@ public void serializeContents(short[] value, JsonGenerator g, SerializerProvider } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - //no "short" type defined by json - ObjectNode o = createSchemaNode("array", true); - return o.set("items", createSchemaNode("integer")); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException @@ -311,15 +294,6 @@ private final void _writeArrayContents(JsonGenerator g, char[] value) } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - ObjectNode o = createSchemaNode("array", true); - ObjectNode itemSchema = createSchemaNode("string"); - itemSchema.put("type", "string"); - return o.set("items", itemSchema); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException @@ -402,11 +376,6 @@ public void serializeContents(int[] value, JsonGenerator g, SerializerProvider p } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("array", true).set("items", createSchemaNode("integer")); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { @@ -475,13 +444,6 @@ public void serializeContents(long[] value, JsonGenerator g, SerializerProvider } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - return createSchemaNode("array", true) - .set("items", createSchemaNode("number", true)); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException @@ -554,11 +516,6 @@ public void serializeContents(float[] value, JsonGenerator g, SerializerProvider } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("array", true).set("items", createSchemaNode("number")); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { @@ -639,11 +596,6 @@ public void serializeContents(double[] value, JsonGenerator g, SerializerProvide } } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("array", true).set("items", createSchemaNode("number")); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java index f16210114b..b5b2fa7db0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java @@ -1,20 +1,18 @@ package com.fasterxml.jackson.databind.ser.std; +import java.io.IOException; + import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.ResolvableSerializer; import com.fasterxml.jackson.databind.util.ClassUtil; import com.fasterxml.jackson.databind.util.Converter; -import java.io.IOException; -import java.lang.reflect.Type; - /** * Serializer implementation where given Java type is first converted * to an intermediate "delegate type" (using a configured @@ -29,7 +27,7 @@ public class StdDelegatingSerializer extends StdSerializer implements ContextualSerializer, ResolvableSerializer, - JsonFormatVisitable, SchemaAware + JsonFormatVisitable { protected final Converter _converter; @@ -202,26 +200,6 @@ public boolean isEmpty(SerializerProvider prov, Object value) /********************************************************** */ - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - throws JsonMappingException - { - if (_delegateSerializer instanceof SchemaAware) { - return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint); - } - return super.getSchema(provider, typeHint); - } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint, - boolean isOptional) throws JsonMappingException - { - if (_delegateSerializer instanceof SchemaAware) { - return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint, isOptional); - } - return super.getSchema(provider, typeHint); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException @@ -261,8 +239,6 @@ protected Object convertValue(Object value) { * actual type value gets converted to is not specified beyond basic * {@link java.lang.Object}, and where serializer needs to be located dynamically * based on actual value type. - * - * @since 2.6 */ protected JsonSerializer _findSerializer(Object value, SerializerProvider serializers) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java index b99bab3289..5c528469d4 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java @@ -1,7 +1,6 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.*; -import java.lang.reflect.Type; import java.util.*; import java.util.concurrent.atomic.*; @@ -79,12 +78,7 @@ public static class AtomicBooleanSerializer public void serialize(AtomicBoolean value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException { gen.writeBoolean(value.get()); } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("boolean", true); - } - + @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitor.expectBooleanFormat(typeHint); @@ -100,12 +94,7 @@ public static class AtomicIntegerSerializer public void serialize(AtomicInteger value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException { gen.writeNumber(value.get()); } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("integer", true); - } - + @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { @@ -122,12 +111,7 @@ public static class AtomicLongSerializer public void serialize(AtomicLong value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException { gen.writeNumber(value.get()); } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("integer", true); - } - + @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java index 916a9c980c..bc27c89755 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java @@ -1,13 +1,11 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; @@ -47,13 +45,6 @@ public void serializeWithType(T value, JsonGenerator g, SerializerProvider provi typeSer.writeTypeSuffix(g, typeIdDef); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - throws JsonMappingException - { - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java index 52ed126145..4ca9a5c730 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java @@ -2,7 +2,6 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Type; import java.util.Collection; import java.util.IdentityHashMap; import java.util.Map; @@ -15,7 +14,6 @@ import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.*; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.FilterProvider; @@ -27,19 +25,16 @@ * Base class used by all standard serializers, and can also * be used for custom serializers (in fact, this is the recommended * base class to use). - * Provides convenience methods for implementing {@link SchemaAware} */ public abstract class StdSerializer extends JsonSerializer - implements JsonFormatVisitable, SchemaAware, java.io.Serializable + implements JsonFormatVisitable, java.io.Serializable { private static final long serialVersionUID = 1L; /** * Key used for storing a lock object to prevent infinite recursion when * constructing converting serializers. - * - * @since 2.9 */ private final static Object KEY_CONTENT_CONVERTER_LOCK = new Object(); @@ -117,31 +112,6 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t visitor.expectAnyFormat(typeHint); } - /** - * Default implementation simply claims type is "string"; usually - * overriden by custom serializers. - */ - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException - { - return createSchemaNode("string"); - } - - /** - * Default implementation simply claims type is "string"; usually - * overriden by custom serializers. - */ - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) - throws JsonMappingException - { - ObjectNode schema = (ObjectNode) getSchema(provider, typeHint); - if (!isOptional) { - schema.put("required", !isOptional); - } - return schema; - } - /* /********************************************************** /* Helper methods for JSON Schema generation @@ -167,8 +137,6 @@ protected ObjectNode createSchemaNode(String type, boolean isOptional) /** * Helper method that calls necessary visit method(s) to indicate that the * underlying JSON type is JSON String. - * - * @since 2.7 */ protected void visitStringFormat(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { @@ -259,9 +227,6 @@ protected void visitArrayFormat(JsonFormatVisitorWrapper visitor, JavaType typeH } } - /** - * @since 2.7 - */ protected void visitArrayFormat(JsonFormatVisitorWrapper visitor, JavaType typeHint, JsonFormatTypes itemType) throws JsonMappingException @@ -468,9 +433,6 @@ protected Boolean findFormatFeature(SerializerProvider provider, return null; } - /** - * @since 2.8 - */ protected JsonInclude.Value findIncludeOverrides(SerializerProvider provider, BeanProperty prop, Class typeForDefaults) { @@ -483,8 +445,6 @@ protected JsonInclude.Value findIncludeOverrides(SerializerProvider provider, /** * Convenience method for finding out possibly configured content value serializer. - * - * @since 2.7.4 */ protected JsonSerializer findAnnotatedContentSerializer(SerializerProvider serializers, BeanProperty property) @@ -520,16 +480,10 @@ protected boolean isDefaultSerializer(JsonSerializer serializer) { return ClassUtil.isJacksonStdImpl(serializer); } - /** - * @since 2.9 - */ protected final static boolean _neitherNull(Object a, Object b) { return (a != null) && (b != null); } - /** - * @since 2.9 - */ protected final static boolean _nonEmpty(Collection c) { return (c != null) && !c.isEmpty(); } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java index d3c621c72a..55077975ac 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java @@ -1,13 +1,11 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; @@ -49,11 +47,6 @@ public final void serializeWithType(Object value, JsonGenerator gen, SerializerP gen.writeString((String) value); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) { - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { visitStringFormat(visitor, typeHint); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializer.java index eb7342281b..b546f90db1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializer.java @@ -1,13 +1,11 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; @@ -38,11 +36,6 @@ public class ToStringSerializer */ public ToStringSerializer() { super(Object.class); } - /** - * Sometimes it may actually make sense to retain actual handled type, so... - * - * @since 2.5 - */ public ToStringSerializer(Class handledType) { super(handledType, false); } @@ -81,11 +74,6 @@ public void serializeWithType(Object value, JsonGenerator g, SerializerProvider typeSer.writeTypeSuffix(g, typeIdDef); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - return createSchemaNode("string", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java index a7624b078e..2ee7a7e432 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java @@ -1,13 +1,11 @@ package com.fasterxml.jackson.databind.ser.std; import java.io.IOException; -import java.lang.reflect.Type; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; @@ -56,14 +54,6 @@ public final void serializeWithType(TokenBuffer value, JsonGenerator g, typeSer.writeTypeSuffix(g, typeIdDef); } - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) - { - // Not 100% sure what we should say here: type is basically not known. - // This seems like closest approximation - return createSchemaNode("any", true); - } - @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/util/ISO8601DateFormat.java b/src/main/java/com/fasterxml/jackson/databind/util/ISO8601DateFormat.java deleted file mode 100644 index bd63930405..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/util/ISO8601DateFormat.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.fasterxml.jackson.databind.util; - -import java.text.*; -import java.util.Date; -import java.util.GregorianCalendar; - -/** - * Provide a fast thread-safe formatter/parser DateFormat for ISO8601 dates ONLY. - * It was mainly done to be used with Jackson JSON Processor. - *

    - * Watch out for clone implementation that returns itself. - *

    - * All other methods but parse and format and clone are undefined behavior. - * - * @see ISO8601Utils - */ -@Deprecated // since 2.9 -public class ISO8601DateFormat extends DateFormat -{ - private static final long serialVersionUID = 1L; - - public ISO8601DateFormat() { - this.numberFormat = new DecimalFormat();; - this.calendar = new GregorianCalendar();; - } - - @Override - public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { - toAppendTo.append(ISO8601Utils.format(date)); - return toAppendTo; - } - - @Override - public Date parse(String source, ParsePosition pos) { - try { - return ISO8601Utils.parse(source, pos); - } - catch (ParseException e) { - return null; - } - } - - //supply our own parse(String) since pos isn't updated during parsing, - //but the exception should have the right error offset. - @Override - public Date parse(String source) throws ParseException { - return ISO8601Utils.parse(source, new ParsePosition(0)); - } - - @Override - public Object clone() { - return this; - } -} diff --git a/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java b/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java deleted file mode 100644 index 8078317a6f..0000000000 --- a/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.fasterxml.jackson.databind.util; - -import java.text.ParseException; -import java.text.ParsePosition; -import java.util.*; - -/** - * Utilities methods for manipulating dates in iso8601 format. This is much much faster and GC friendly than using SimpleDateFormat so - * highly suitable if you (un)serialize lots of date objects. - * - * Supported parse format: [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:]mm]] - * - * @see this specification - */ -@Deprecated // since 2.9 -public class ISO8601Utils -{ - protected final static int DEF_8601_LEN = "yyyy-MM-ddThh:mm:ss.SSS+00:00".length(); - - /** - * Timezone we use for 'Z' in ISO-8601 date/time values: since 2.7 - * {@link #TIMEZONE_UTC}; with earlier versions up to 2.7 was {@link #TIMEZONE_GMT}. - */ - private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - - /* - /********************************************************** - /* Formatting - /********************************************************** - */ - - /** - * Format a date into 'yyyy-MM-ddThh:mm:ssZ' (default timezone, no milliseconds precision) - * - * @param date the date to format - * @return the date formatted as 'yyyy-MM-ddThh:mm:ssZ' - */ - public static String format(Date date) { - return format(date, false, TIMEZONE_Z); - } - - /** - * Format a date into 'yyyy-MM-ddThh:mm:ss[.sss]Z' (GMT timezone) - * - * @param date the date to format - * @param millis true to include millis precision otherwise false - * @return the date formatted as 'yyyy-MM-ddThh:mm:ss[.sss]Z' - */ - public static String format(Date date, boolean millis) { - return format(date, millis, TIMEZONE_Z); - } - - @Deprecated // since 2.9 - public static String format(Date date, boolean millis, TimeZone tz) { - return format(date, millis, tz, Locale.US); - } - - /** - * Format date into yyyy-MM-ddThh:mm:ss[.sss][Z|[+-]hh:mm] - * - * @param date the date to format - * @param millis true to include millis precision otherwise false - * @param tz timezone to use for the formatting (UTC will produce 'Z') - * @return the date formatted as yyyy-MM-ddThh:mm:ss[.sss][Z|[+-]hh:mm] - * - * @since 2.9 - */ - public static String format(Date date, boolean millis, TimeZone tz, Locale loc) { - Calendar calendar = new GregorianCalendar(tz, loc); - calendar.setTime(date); - - // estimate capacity of buffer as close as we can (yeah, that's pedantic ;) - StringBuilder sb = new StringBuilder(30); - sb.append(String.format( - "%04d-%02d-%02dT%02d:%02d:%02d", - calendar.get(Calendar.YEAR), - calendar.get(Calendar.MONTH) + 1, - calendar.get(Calendar.DAY_OF_MONTH), - calendar.get(Calendar.HOUR_OF_DAY), - calendar.get(Calendar.MINUTE), - calendar.get(Calendar.SECOND) - )); - if (millis) { - sb.append(String.format(".%03d", calendar.get(Calendar.MILLISECOND))); - } - - int offset = tz.getOffset(calendar.getTimeInMillis()); - if (offset != 0) { - int hours = Math.abs((offset / (60 * 1000)) / 60); - int minutes = Math.abs((offset / (60 * 1000)) % 60); - sb.append(String.format("%c%02d:%02d", - (offset < 0 ? '-' : '+'), - hours, minutes)); - } else { - sb.append('Z'); - } - return sb.toString(); - } - - /* - /********************************************************** - /* Parsing - /********************************************************** - */ - - /** - * Parse a date from ISO-8601 formatted string. It expects a format - * [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh:mm]] - * - * @param date ISO string to parse in the appropriate format. - * @param pos The position to start parsing from, updated to where parsing stopped. - * @return the parsed date - * @throws ParseException if the date is not in the appropriate format - */ - public static Date parse(String date, ParsePosition pos) throws ParseException { - Exception fail = null; - try { - int offset = pos.getIndex(); - - // extract year - int year = parseInt(date, offset, offset += 4); - if (checkOffset(date, offset, '-')) { - offset += 1; - } - - // extract month - int month = parseInt(date, offset, offset += 2); - if (checkOffset(date, offset, '-')) { - offset += 1; - } - - // extract day - int day = parseInt(date, offset, offset += 2); - // default time value - int hour = 0; - int minutes = 0; - int seconds = 0; - int milliseconds = 0; // always use 0 otherwise returned date will include millis of current time - - // if the value has no time component (and no time zone), we are done - boolean hasT = checkOffset(date, offset, 'T'); - - if (!hasT && (date.length() <= offset)) { - Calendar calendar = new GregorianCalendar(year, month - 1, day); - - pos.setIndex(offset); - return calendar.getTime(); - } - - if (hasT) { - - // extract hours, minutes, seconds and milliseconds - hour = parseInt(date, offset += 1, offset += 2); - if (checkOffset(date, offset, ':')) { - offset += 1; - } - - minutes = parseInt(date, offset, offset += 2); - if (checkOffset(date, offset, ':')) { - offset += 1; - } - // second and milliseconds can be optional - if (date.length() > offset) { - char c = date.charAt(offset); - if (c != 'Z' && c != '+' && c != '-') { - seconds = parseInt(date, offset, offset += 2); - if (seconds > 59 && seconds < 63) seconds = 59; // truncate up to 3 leap seconds - // milliseconds can be optional in the format - if (checkOffset(date, offset, '.')) { - offset += 1; - int endOffset = indexOfNonDigit(date, offset + 1); // assume at least one digit - int parseEndOffset = Math.min(endOffset, offset + 3); // parse up to 3 digits - int fraction = parseInt(date, offset, parseEndOffset); - // compensate for "missing" digits - switch (parseEndOffset - offset) { // number of digits parsed - case 2: - milliseconds = fraction * 10; - break; - case 1: - milliseconds = fraction * 100; - break; - default: - milliseconds = fraction; - } - offset = endOffset; - } - } - } - } - - // extract timezone - if (date.length() <= offset) { - throw new IllegalArgumentException("No time zone indicator"); - } - - TimeZone timezone = null; - char timezoneIndicator = date.charAt(offset); - - if (timezoneIndicator == 'Z') { - timezone = TIMEZONE_Z; - offset += 1; - } else if (timezoneIndicator == '+' || timezoneIndicator == '-') { - String timezoneOffset = date.substring(offset); - offset += timezoneOffset.length(); - // 18-Jun-2015, tatu: Minor simplification, skip offset of "+0000"/"+00:00" - if ("+0000".equals(timezoneOffset) || "+00:00".equals(timezoneOffset)) { - timezone = TIMEZONE_Z; - } else { - // 18-Jun-2015, tatu: Looks like offsets only work from GMT, not UTC... - // not sure why, but that's the way it looks. Further, Javadocs for - // `java.util.TimeZone` specifically instruct use of GMT as base for - // custom timezones... odd. - String timezoneId = "GMT" + timezoneOffset; -// String timezoneId = "UTC" + timezoneOffset; - - timezone = TimeZone.getTimeZone(timezoneId); - - String act = timezone.getID(); - if (!act.equals(timezoneId)) { - /* 22-Jan-2015, tatu: Looks like canonical version has colons, but we may be given - * one without. If so, don't sweat. - * Yes, very inefficient. Hopefully not hit often. - * If it becomes a perf problem, add 'loose' comparison instead. - */ - String cleaned = act.replace(":", ""); - if (!cleaned.equals(timezoneId)) { - throw new IndexOutOfBoundsException("Mismatching time zone indicator: "+timezoneId+" given, resolves to " - +timezone.getID()); - } - } - } - } else { - throw new IndexOutOfBoundsException("Invalid time zone indicator '" + timezoneIndicator+"'"); - } - - Calendar calendar = new GregorianCalendar(timezone); - calendar.setLenient(false); - calendar.set(Calendar.YEAR, year); - calendar.set(Calendar.MONTH, month - 1); - calendar.set(Calendar.DAY_OF_MONTH, day); - calendar.set(Calendar.HOUR_OF_DAY, hour); - calendar.set(Calendar.MINUTE, minutes); - calendar.set(Calendar.SECOND, seconds); - calendar.set(Calendar.MILLISECOND, milliseconds); - - pos.setIndex(offset); - return calendar.getTime(); - // If we get a ParseException it'll already have the right message/offset. - // Other exception types can convert here. - } catch (Exception e) { - fail = e; - } - String input = (date == null) ? null : ('"' + date + '"'); - String msg = fail.getMessage(); - if (msg == null || msg.isEmpty()) { - msg = "("+fail.getClass().getName()+")"; - } - ParseException ex = new ParseException("Failed to parse date " + input + ": " + msg, pos.getIndex()); - ex.initCause(fail); - throw ex; - } - - /** - * Check if the expected character exist at the given offset in the value. - * - * @param value the string to check at the specified offset - * @param offset the offset to look for the expected character - * @param expected the expected character - * @return true if the expected character exist at the given offset - */ - private static boolean checkOffset(String value, int offset, char expected) { - return (offset < value.length()) && (value.charAt(offset) == expected); - } - - /** - * Parse an integer located between 2 given offsets in a string - * - * @param value the string to parse - * @param beginIndex the start index for the integer in the string - * @param endIndex the end index for the integer in the string - * @return the int - * @throws NumberFormatException if the value is not a number - */ - private static int parseInt(String value, int beginIndex, int endIndex) throws NumberFormatException { - if (beginIndex < 0 || endIndex > value.length() || beginIndex > endIndex) { - throw new NumberFormatException(value); - } - // use same logic as in Integer.parseInt() but less generic we're not supporting negative values - int i = beginIndex; - int result = 0; - int digit; - if (i < endIndex) { - digit = Character.digit(value.charAt(i++), 10); - if (digit < 0) { - throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex)); - } - result = -digit; - } - while (i < endIndex) { - digit = Character.digit(value.charAt(i++), 10); - if (digit < 0) { - throw new NumberFormatException("Invalid number: " + value.substring(beginIndex, endIndex)); - } - result *= 10; - result -= digit; - } - return -result; - } - - /** - * Returns the index of the first character in the string that is not a digit, starting at offset. - */ - private static int indexOfNonDigit(String string, int offset) { - for (int i = offset; i < string.length(); i++) { - char c = string.charAt(i); - if (c < '0' || c > '9') return i; - } - return string.length(); - } -} diff --git a/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java b/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java index 1d67d55783..3432f4dcdd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java @@ -128,21 +128,6 @@ public void testMiscSettings() throws Exception r = newR; } - @SuppressWarnings("deprecation") - public void testDeprecatedSettings() throws Exception - { - ObjectReader r = MAPPER.reader(); - - // and deprecated variants - ObjectReader newR = r.forType(MAPPER.constructType(String.class)); - assertSame(newR, newR.withType(String.class)); - assertSame(newR, newR.withType(MAPPER.constructType(String.class))); - - newR = newR.withRootName(PropertyName.construct("foo")); - assertNotSame(r, newR); - assertSame(newR, newR.withRootName(PropertyName.construct("foo"))); - } - public void testNoPrefetch() throws Exception { ObjectReader r = MAPPER.reader() diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java index 525671e473..a31a6be86d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java @@ -223,7 +223,7 @@ public void testIntBooleanMap() throws Exception { // to get typing, must use type reference String JSON = "{ \"1\" : true, \"-1\" : false }"; - Map result = MAPPER.readValue + Map result = MAPPER.readValue (JSON, new TypeReference>() { }); assertNotNull(result); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java index 8111b7a1a0..c6bff239e5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java @@ -183,7 +183,7 @@ public void testUntypedMap() throws Exception // Not a guaranteed cast theoretically, but will work: @SuppressWarnings("unchecked") - Map result = (Map)MAPPER.readValue(JSON, Object.class); + Map result = (Map)MAPPER.readValue(JSON, Object.class); assertNotNull(result); assertTrue(result instanceof Map); diff --git a/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java b/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java index 38483325c6..9cfdd83939 100644 --- a/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java @@ -51,23 +51,6 @@ public void testBadDefinition() throws Exception g.close(); } - @SuppressWarnings("deprecation") - public void testInvalidFormat() throws Exception - { - // deprecated methods should still work: - InvalidFormatException e = new InvalidFormatException("Testing", Boolean.TRUE, - String.class); - assertSame(Boolean.TRUE, e.getValue()); - assertNull(e.getProcessor()); - assertNotNull(e); - - e = new InvalidFormatException("Testing", JsonLocation.NA, - Boolean.TRUE, String.class); - assertSame(Boolean.TRUE, e.getValue()); - assertNull(e.getProcessor()); - assertNotNull(e); - } - public void testIgnoredProperty() throws Exception { // first just construct valid instance with some variations diff --git a/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java b/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java index 8380fd5ba4..043bc0e1b3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.*; import com.fasterxml.jackson.databind.ser.BeanPropertyWriter; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; /** * Basic tests to exercise low-level support added for JSON Schema module and @@ -134,10 +133,6 @@ private void _visit(BeanProperty prop) throws JsonMappingException } ser = prov.findValueSerializer(prop.getType(), prop); } - // and this just for bit of extra coverage... - if (ser instanceof StdSerializer) { - assertNotNull(((StdSerializer) ser).getSchema(prov, prop.getType())); - } JsonFormatVisitorWrapper visitor = new JsonFormatVisitorWrapper.Base(getProvider()); ser.acceptJsonFormatVisitor(visitor, prop.getType()); } diff --git a/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java b/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java deleted file mode 100644 index 7edfd4dae2..0000000000 --- a/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.fasterxml.jackson.databind.jsonschema; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Collection; -import java.util.Map; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.ser.FilterProvider; -import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; -import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; - -/** - * @author Ryan Heaton - */ -@SuppressWarnings("deprecation") -public class TestGenerateJsonSchema - extends com.fasterxml.jackson.databind.BaseMapTest -{ - /* - /********************************************************** - /* Helper classes - /********************************************************** - */ - - public static class SimpleBean - { - private int property1; - private String property2; - private String[] property3; - private Collection property4; - @JsonProperty(required=true) - private String property5; - - public int getProperty1() - { - return property1; - } - - public void setProperty1(int property1) - { - this.property1 = property1; - } - - public String getProperty2() - { - return property2; - } - - public void setProperty2(String property2) - { - this.property2 = property2; - } - - public String[] getProperty3() - { - return property3; - } - - public void setProperty3(String[] property3) - { - this.property3 = property3; - } - - public Collection getProperty4() - { - return property4; - } - - public void setProperty4(Collection property4) - { - this.property4 = property4; - } - - public String getProperty5() - { - return property5; - } - - public void setProperty5(String property5) - { - this.property5 = property5; - } - } - - public class TrivialBean { - public String name; - } - - @JsonSerializableSchema(id="myType") - public class BeanWithId { - public String value; - } - - static class UnwrappingRoot - { - public int age; - - @JsonUnwrapped(prefix="name.") - public Name name; - } - - static class Name { - public String first, last; - } - - @JsonPropertyOrder({ "dec", "bigInt" }) - static class Numbers { - public BigDecimal dec; - public BigInteger bigInt; - } - - /* - /********************************************************** - /* Unit tests - /********************************************************** - */ - - private final ObjectMapper MAPPER = new ObjectMapper(); - - /** - * tests generating json-schema stuff. - */ - public void testOldSchemaGeneration() throws Exception - { - JsonSchema jsonSchema = MAPPER.generateJsonSchema(SimpleBean.class); - - assertNotNull(jsonSchema); - - // test basic equality, and that equals() handles null, other obs - assertTrue(jsonSchema.equals(jsonSchema)); - assertFalse(jsonSchema.equals(null)); - assertFalse(jsonSchema.equals("foo")); - - // other basic things - assertNotNull(jsonSchema.toString()); - assertNotNull(JsonSchema.getDefaultSchemaNode()); - - ObjectNode root = jsonSchema.getSchemaNode(); - assertEquals("object", root.get("type").asText()); - assertEquals(false, root.path("required").booleanValue()); - JsonNode propertiesSchema = root.get("properties"); - assertNotNull(propertiesSchema); - JsonNode property1Schema = propertiesSchema.get("property1"); - assertNotNull(property1Schema); - assertEquals("integer", property1Schema.get("type").asText()); - assertEquals(false, property1Schema.path("required").booleanValue()); - JsonNode property2Schema = propertiesSchema.get("property2"); - assertNotNull(property2Schema); - assertEquals("string", property2Schema.get("type").asText()); - assertEquals(false, property2Schema.path("required").booleanValue()); - JsonNode property3Schema = propertiesSchema.get("property3"); - assertNotNull(property3Schema); - assertEquals("array", property3Schema.get("type").asText()); - assertEquals(false, property3Schema.path("required").booleanValue()); - assertEquals("string", property3Schema.get("items").get("type").asText()); - JsonNode property4Schema = propertiesSchema.get("property4"); - assertNotNull(property4Schema); - assertEquals("array", property4Schema.get("type").asText()); - assertEquals(false, property4Schema.path("required").booleanValue()); - assertEquals("number", property4Schema.get("items").get("type").asText()); - } - - @JsonFilter("filteredBean") - protected static class FilteredBean { - - @JsonProperty - private String secret = "secret"; - - @JsonProperty - private String obvious = "obvious"; - - public String getSecret() { return secret; } - public void setSecret(String s) { secret = s; } - - public String getObvious() { return obvious; } - public void setObvious(String s) {obvious = s; } - } - - final static FilterProvider secretFilterProvider = new SimpleFilterProvider() - .addFilter("filteredBean", SimpleBeanPropertyFilter.filterOutAllExcept(new String[]{"obvious"})); - - public void testGeneratingJsonSchemaWithFilters() throws Exception { - ObjectMapper mapper = new ObjectMapper(); - mapper.setFilters(secretFilterProvider); - JsonSchema schema = mapper.generateJsonSchema(FilteredBean.class); - JsonNode node = schema.getSchemaNode().get("properties"); - assertTrue(node.has("obvious")); - assertFalse(node.has("secret")); - } - - /** - * Additional unit test for verifying that schema object itself - * can be properly serialized - */ - public void testSchemaSerialization() throws Exception - { - JsonSchema jsonSchema = MAPPER.generateJsonSchema(SimpleBean.class); - Map result = writeAndMap(MAPPER, jsonSchema); - assertNotNull(result); - // no need to check out full structure, just basics... - assertEquals("object", result.get("type")); - // only add 'required' if it is true... - assertNull(result.get("required")); - assertNotNull(result.get("properties")); - } - - public void testThatObjectsHaveNoItems() throws Exception - { - JsonSchema jsonSchema = MAPPER.generateJsonSchema(TrivialBean.class); - String json = jsonSchema.toString().replaceAll("\"", "'"); - // can we count on ordering being stable? I think this is true with current ObjectNode impl - // as perh [JACKSON-563]; 'required' is only included if true - assertEquals("{'type':'object','properties':{'name':{'type':'string'}}}", - json); - } - - public void testSchemaId() throws Exception - { - JsonSchema jsonSchema = MAPPER.generateJsonSchema(BeanWithId.class); - String json = jsonSchema.toString().replaceAll("\"", "'"); - assertEquals("{'type':'object','id':'myType','properties':{'value':{'type':'string'}}}", - json); - } - - // [databind#271] - public void testUnwrapping() throws Exception - { - JsonSchema jsonSchema = MAPPER.generateJsonSchema(UnwrappingRoot.class); - String json = jsonSchema.toString().replaceAll("\"", "'"); - String EXP = "{'type':'object'," - +"'properties':{'age':{'type':'integer'}," - +"'name.first':{'type':'string'},'name.last':{'type':'string'}}}"; - assertEquals(EXP, json); - } - - // - public void testNumberTypes() throws Exception - { - JsonSchema jsonSchema = MAPPER.generateJsonSchema(Numbers.class); - String json = quotesToApos(jsonSchema.toString()); - String EXP = "{'type':'object'," - +"'properties':{'dec':{'type':'number'}," - +"'bigInt':{'type':'integer'}}}"; - assertEquals(EXP, json); - } -} diff --git a/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestReadJsonSchema.java b/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestReadJsonSchema.java deleted file mode 100644 index 164533bc8a..0000000000 --- a/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestReadJsonSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.fasterxml.jackson.databind.jsonschema; - -import java.util.*; - -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.jsonschema.JsonSchema; - -/** - * Trivial test to ensure JsonSchema can be also deserialized - */ -@SuppressWarnings("deprecation") -public class TestReadJsonSchema - extends com.fasterxml.jackson.databind.BaseMapTest -{ - enum SchemaEnum { YES, NO; } - - static class Schemable { - public String name; - public char[] nameBuffer; - - // We'll include tons of stuff, just to force generation of schema - public boolean[] states; - public byte[] binaryData; - public short[] shorts; - public int[] ints; - public long[] longs; - - public float[] floats; - public double[] doubles; - - public Object[] objects; - public JsonSerializable someSerializable; - - public Iterable iterableOhYeahBaby; - - public List extra; - public ArrayList extra2; - public Iterator extra3; - - public Map sizes; - public EnumMap> whatever; - - SchemaEnum testEnum; - public EnumSet testEnums; - } - - /** - * Verifies that a simple schema that is serialized can be - * deserialized back to equal schema instance - */ - public void testDeserializeSimple() throws Exception - { - ObjectMapper mapper = new ObjectMapper(); - JsonSchema schema = mapper.generateJsonSchema(Schemable.class); - assertNotNull(schema); - - String schemaStr = mapper.writeValueAsString(schema); - assertNotNull(schemaStr); - JsonSchema result = mapper.readValue(schemaStr, JsonSchema.class); - assertEquals("Trying to read from '"+schemaStr+"'", schema, result); - } -} diff --git a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java index 239e488b51..d604366091 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java @@ -1,10 +1,8 @@ package com.fasterxml.jackson.databind.module; import java.io.IOException; -import java.lang.reflect.Type; import java.util.*; - import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.*; @@ -40,26 +38,21 @@ static class CustomBeanSerializer extends StdSerializer public CustomBeanSerializer() { super(CustomBean.class); } @Override - public void serialize(CustomBean value, JsonGenerator jgen, SerializerProvider provider) + public void serialize(CustomBean value, JsonGenerator g, SerializerProvider provider) throws IOException, JsonProcessingException { // We will write it as a String, with '|' as delimiter - jgen.writeString(value.str + "|" + value.num); - } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - return null; + g.writeString(value.str + "|" + value.num); } } static class CustomBeanDeserializer extends JsonDeserializer { @Override - public CustomBean deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException + public CustomBean deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException { - String text = jp.getText(); + String text = p.getText(); int ix = text.indexOf('|'); if (ix < 0) { throw new IOException("Failed to parse String value of \""+text+"\""); @@ -75,25 +68,20 @@ static class SimpleEnumSerializer extends StdSerializer public SimpleEnumSerializer() { super(SimpleEnum.class); } @Override - public void serialize(SimpleEnum value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException + public void serialize(SimpleEnum value, JsonGenerator g, SerializerProvider provider) + throws IOException { - jgen.writeString(value.name().toLowerCase()); - } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - return null; + g.writeString(value.name().toLowerCase()); } } static class SimpleEnumDeserializer extends JsonDeserializer { @Override - public SimpleEnum deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException + public SimpleEnum deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException { - return SimpleEnum.valueOf(jp.getText().toUpperCase()); + return SimpleEnum.valueOf(p.getText().toUpperCase()); } } @@ -116,8 +104,8 @@ static class BaseSerializer extends StdScalarSerializer public BaseSerializer() { super(Base.class); } @Override - public void serialize(Base value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - jgen.writeString("Base:"+value.getText()); + public void serialize(Base value, JsonGenerator g, SerializerProvider provider) throws IOException { + g.writeString("Base:"+value.getText()); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestKeySerializers.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestKeySerializers.java index dd97392231..0712aa6fe7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestKeySerializers.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestKeySerializers.java @@ -223,7 +223,6 @@ public void testUnWrappedMapWithDefaultType() throws Exception{ } // [databind#838] - @SuppressWarnings("deprecation") public void testUnWrappedMapWithKeySerializer() throws Exception{ SimpleModule mod = new SimpleModule("test"); mod.addKeySerializer(ABC.class, new ABCKeySerializer()); @@ -231,7 +230,6 @@ public void testUnWrappedMapWithKeySerializer() throws Exception{ .registerModule(mod) .enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .disable(SerializationFeature.WRITE_NULL_MAP_VALUES) .setSerializationInclusion(JsonInclude.Include.NON_EMPTY) ; diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonInclude1327Test.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonInclude1327Test.java index bac6df4630..34662bffbd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonInclude1327Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonInclude1327Test.java @@ -5,12 +5,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; /** * Unit tests for checking that alternative settings for - * {@link JsonSerialize#include} annotation property work - * as expected. + * inclusion annotation properties work as expected. */ public class JsonInclude1327Test extends BaseMapTest diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeOverrideTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeOverrideTest.java index 1a8dbc58ba..fe2b443156 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeOverrideTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeOverrideTest.java @@ -13,7 +13,7 @@ /** * Unit tests for checking that overridden settings for - * {@link com.fasterxml.jackson.databind.annotation.JsonSerialize#include} annotation property work + * JsonInclude annotation property work * as expected. */ public class JsonIncludeOverrideTest diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java index 5d18dfff41..1f6ed81bab 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java @@ -8,11 +8,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; /** * Unit tests for checking that alternative settings for - * {@link JsonSerialize#include} annotation property work + * JsonInclude annotation property work * as expected. */ public class JsonIncludeTest diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java index ab2a9a93fb..cd0ffb65d0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java @@ -8,9 +8,9 @@ import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonGenerator; + import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.*; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; @@ -89,12 +89,6 @@ public void serializeAsElement(Object elementValue, JsonGenerator jgen, // not needed for testing } - @Override - @Deprecated - public void depositSchemaProperty(PropertyWriter writer, - ObjectNode propertiesNode, SerializerProvider provider) - throws JsonMappingException { } - @Override public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, @@ -236,21 +230,6 @@ public void testMapAbsentValue() throws IOException assertEquals(aposToQuotes("{'a':'foo'}"), json); } - @SuppressWarnings("deprecation") - public void testMapNullSerialization() throws IOException - { - ObjectMapper m = new ObjectMapper(); - Map map = new HashMap(); - map.put("a", null); - // by default, should output null-valued entries: - assertEquals("{\"a\":null}", m.writeValueAsString(map)); - // but not if explicitly asked not to (note: config value is dynamic here) - - m = new ObjectMapper(); - m.disable(SerializationFeature.WRITE_NULL_MAP_VALUES); - assertEquals("{}", m.writeValueAsString(map)); - } - // [databind#527] public void testMapWithOnlyEmptyValues() throws IOException { diff --git a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java b/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java deleted file mode 100644 index 20e941270c..0000000000 --- a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.fasterxml.jackson.databind.util; - -import java.text.DateFormat; -import java.util.*; - - -import com.fasterxml.jackson.databind.BaseMapTest; - -@SuppressWarnings("deprecation") -public class ISO8601DateFormatTest extends BaseMapTest -{ - private ISO8601DateFormat df; - private Date date; - - @Override - public void setUp() - { - Calendar cal = new GregorianCalendar(2007, 8 - 1, 13, 19, 51, 23); - cal.setTimeZone(TimeZone.getTimeZone("GMT")); - cal.set(Calendar.MILLISECOND, 0); - date = cal.getTime(); - df = new ISO8601DateFormat(); - } - - public void testFormat() { - String result = df.format(date); - assertEquals("2007-08-13T19:51:23Z", result); - } - - public void testParse() throws Exception { - Date result = df.parse("2007-08-13T19:51:23Z"); - assertEquals(date, result); - - // Test parsing date-only values with and without a timezone designation - Date dateOnly = df.parse("2007-08-14"); - Calendar cal = new GregorianCalendar(2007, 8-1, 14); - assertEquals(cal.getTime(), dateOnly); - - dateOnly = df.parse("2007-08-14Z"); - cal = new GregorianCalendar(2007, 8-1, 14); - cal.setTimeZone(TimeZone.getTimeZone("GMT")); - assertEquals(cal.getTime(), dateOnly); - } - - public void testPartialParse() throws Exception { - java.text.ParsePosition pos = new java.text.ParsePosition(0); - String timestamp = "2007-08-13T19:51:23Z"; - Date result = df.parse(timestamp + "hello", pos); - - assertEquals(date, result); - assertEquals(timestamp.length(), pos.getIndex()); - } - - public void testCloneObject() throws Exception { - DateFormat clone = (DateFormat)df.clone(); - assertSame(df, clone); - } - - public void testHashCodeEquals() throws Exception { - // for [databind#1130] - DateFormat defaultDF = StdDateFormat.instance; - defaultDF.hashCode(); - assertTrue(defaultDF.equals(defaultDF)); - } -} diff --git a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java b/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java deleted file mode 100644 index 5ce6751362..0000000000 --- a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.fasterxml.jackson.databind.util; - -import com.fasterxml.jackson.databind.BaseMapTest; - -import java.text.ParseException; -import java.text.ParsePosition; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; -import java.util.concurrent.TimeUnit; - -@SuppressWarnings("deprecation") -public class ISO8601UtilsTest extends BaseMapTest -{ - private Date date; - private Date dateWithoutTime; - private Date dateZeroMillis; - private Date dateZeroSecondAndMillis; - - @Override - public void setUp() { - Calendar cal = new GregorianCalendar(2007, 8 - 1, 13, 19, 51, 23); - cal.setTimeZone(TimeZone.getTimeZone("GMT")); - cal.set(Calendar.MILLISECOND, 789); - date = cal.getTime(); - cal.set(Calendar.MILLISECOND, 0); - dateZeroMillis = cal.getTime(); - cal.set(Calendar.SECOND, 0); - dateZeroSecondAndMillis = cal.getTime(); - - cal = new GregorianCalendar(2007, 8 - 1, 13, 0, 0, 0); - cal.set(Calendar.MILLISECOND, 0); - cal.setTimeZone(TimeZone.getTimeZone("GMT")); - dateWithoutTime = cal.getTime(); - - } - - public void testFormat() { - String result = ISO8601Utils.format(date); - assertEquals("2007-08-13T19:51:23Z", result); - } - - public void testFormatMillis() { - String result = ISO8601Utils.format(date, true); - assertEquals("2007-08-13T19:51:23.789Z", result); - - result = ISO8601Utils.format(date, false); - assertEquals("2007-08-13T19:51:23Z", result); - } - - public void testFormatTimeZone() { - String result = ISO8601Utils.format(date, false, TimeZone.getTimeZone("GMT+02:00")); - assertEquals("2007-08-13T21:51:23+02:00", result); - result = ISO8601Utils.format(date, true, TimeZone.getTimeZone("GMT+02:00")); - assertEquals("2007-08-13T21:51:23.789+02:00", result); - result = ISO8601Utils.format(date, true, TimeZone.getTimeZone("GMT")); - assertEquals("2007-08-13T19:51:23.789Z", result); - } - - public void testParse() throws java.text.ParseException { - Date d = ISO8601Utils.parse("2007-08-13T19:51:23.789Z", new ParsePosition(0)); - assertEquals(date, d); - - d = ISO8601Utils.parse("2007-08-13T19:51:23Z", new ParsePosition(0)); - assertEquals(dateZeroMillis, d); - - d = ISO8601Utils.parse("2007-08-13T21:51:23.789+02:00", new ParsePosition(0)); - assertEquals(date, d); - } - - public void testParseShortDate() throws java.text.ParseException { - Date d = ISO8601Utils.parse("20070813T19:51:23.789Z", new ParsePosition(0)); - assertEquals(date, d); - - d = ISO8601Utils.parse("20070813T19:51:23Z", new ParsePosition(0)); - assertEquals(dateZeroMillis, d); - - d = ISO8601Utils.parse("20070813T21:51:23.789+02:00", new ParsePosition(0)); - assertEquals(date, d); - } - - public void testParseShortTime() throws java.text.ParseException { - Date d = ISO8601Utils.parse("2007-08-13T195123.789Z", new ParsePosition(0)); - assertEquals(date, d); - - d = ISO8601Utils.parse("2007-08-13T195123Z", new ParsePosition(0)); - assertEquals(dateZeroMillis, d); - - d = ISO8601Utils.parse("2007-08-13T215123.789+02:00", new ParsePosition(0)); - assertEquals(date, d); - } - - public void testParseShortDateTime() throws java.text.ParseException { - Date d = ISO8601Utils.parse("20070813T195123.789Z", new ParsePosition(0)); - assertEquals(date, d); - - d = ISO8601Utils.parse("20070813T195123Z", new ParsePosition(0)); - assertEquals(dateZeroMillis, d); - - d = ISO8601Utils.parse("20070813T215123.789+02:00", new ParsePosition(0)); - assertEquals(date, d); - } - - public void testParseWithoutTime() throws ParseException { - Date d = ISO8601Utils.parse("2007-08-13Z", new ParsePosition(0)); - assertEquals(dateWithoutTime, d); - - d = ISO8601Utils.parse("20070813Z", new ParsePosition(0)); - assertEquals(dateWithoutTime, d); - - d = ISO8601Utils.parse("2007-08-13+00:00", new ParsePosition(0)); - assertEquals(dateWithoutTime, d); - - d = ISO8601Utils.parse("20070813+00:00", new ParsePosition(0)); - assertEquals(dateWithoutTime, d); - } - - public void testParseOptional() throws java.text.ParseException { - Date d = ISO8601Utils.parse("2007-08-13T19:51Z", new ParsePosition(0)); - assertEquals(dateZeroSecondAndMillis, d); - - d = ISO8601Utils.parse("2007-08-13T1951Z", new ParsePosition(0)); - assertEquals(dateZeroSecondAndMillis, d); - - d = ISO8601Utils.parse("2007-08-13T21:51+02:00", new ParsePosition(0)); - assertEquals(dateZeroSecondAndMillis, d); - } - - public void testParseRfc3339Examples() throws java.text.ParseException { - // Two digit milliseconds. - Date d = ISO8601Utils.parse("1985-04-12T23:20:50.52Z", new ParsePosition(0)); - assertEquals(newDate(1985, 4, 12, 23, 20, 50, 520, 0), d); - - d = ISO8601Utils.parse("1996-12-19T16:39:57-08:00", new ParsePosition(0)); - assertEquals(newDate(1996, 12, 19, 16, 39, 57, 0, -8 * 60), d); - - // Truncated leap second. - d = ISO8601Utils.parse("1990-12-31T23:59:60Z", new ParsePosition(0)); - assertEquals(newDate(1990, 12, 31, 23, 59, 59, 0, 0), d); - - // Truncated leap second. - d = ISO8601Utils.parse("1990-12-31T15:59:60-08:00", new ParsePosition(0)); - assertEquals(newDate(1990, 12, 31, 15, 59, 59, 0, -8 * 60), d); - - // Two digit milliseconds. - d = ISO8601Utils.parse("1937-01-01T12:00:27.87+00:20", new ParsePosition(0)); - assertEquals(newDate(1937, 1, 1, 12, 0, 27, 870, 20), d); - } - - public void testFractionalSeconds() throws java.text.ParseException { - Date d = ISO8601Utils.parse("1970-01-01T00:00:00.9Z", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 900, 0), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.09Z", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 90, 0), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.009Z", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 9, 0), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.0009Z", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 0, 0), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.2147483647Z", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 214, 0), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.2147483648Z", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 214, 0), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.9+02:00", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 900, 2 * 60), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.09+02:00", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 90, 2 * 60), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.009+02:00", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 9, 2 * 60), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.0009+02:00", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 0, 2 * 60), d); - - d = ISO8601Utils.parse("1970-01-01T00:00:00.2147483648+02:00", new ParsePosition(0)); - assertEquals(newDate(1970, 1, 1, 0, 0, 0, 214, 2 * 60), d); - } - - public void testDecimalWithoutDecimalPointButNoFractionalSeconds() throws java.text.ParseException { - try { - ISO8601Utils.parse("1970-01-01T00:00:00.Z", new ParsePosition(0)); - fail(); - } catch (ParseException expected) { - } - } - - private Date newDate(int year, int month, int day, int hour, - int minute, int second, int millis, int timezoneOffsetMinutes) { - Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("GMT")); - calendar.set(year, month - 1, day, hour, minute, second); - calendar.set(Calendar.MILLISECOND, millis); - return new Date(calendar.getTimeInMillis() - TimeUnit.MINUTES.toMillis(timezoneOffsetMinutes)); - } -}