From a51caf51f33709e126830db66a459c45883bd20f Mon Sep 17 00:00:00 2001 From: panos-kakos <102670093+panos-kakos@users.noreply.github.com> Date: Fri, 24 Jun 2022 17:28:34 +0100 Subject: [PATCH] Java 11497 (#12399) * Added/created parent module (json-modules) * moved json(submodule) to json-modules(parent) * moved json-2(submodule) to json-modules(parent) * moved json-path(submodule) to json-modules(parent) * moved gson(submodule) to json-modules(parent) * deleted sub-modules that we moved to json-modules Co-authored-by: panagiotiskakos --- json-modules/README.md | 3 + {gson => json-modules/gson}/.gitignore | 0 {gson => json-modules/gson}/README.md | 0 {gson => json-modules/gson}/pom.xml | 12 +- .../com/baeldung/gson/entities/ActorGson.java | 0 .../com/baeldung/gson/entities/Animal.java | 0 .../java/com/baeldung/gson/entities/Cow.java | 0 .../java/com/baeldung/gson/entities/Dog.java | 0 .../com/baeldung/gson/entities/Employee.java | 0 .../com/baeldung/gson/entities/Movie.java | 0 .../gson/entities/MovieWithNullValue.java | 0 .../com/baeldung/gson/entities/MyClass.java | 0 .../java/com/baeldung/gson/entities/User.java | 0 .../com/baeldung/gson/entities/Weather.java | 0 .../primitives/models/BooleanExample.java | 0 .../gson/primitives/models/ByteExample.java | 0 .../gson/primitives/models/CharExample.java | 0 .../gson/primitives/models/DoubleExample.java | 0 .../gson/primitives/models/FloatExample.java | 0 .../models/InfinityValuesExample.java | 0 .../gson/primitives/models/LongExample.java | 0 .../primitives/models/PrimitiveBundle.java | 0 .../models/PrimitiveBundleInitialized.java | 0 .../serialization/ActorGsonDeserializer.java | 0 .../serialization/ActorGsonSerializer.java | 0 .../serialization/AnimalDeserializer.java | 0 .../gson/serialization/MapDeserializer.java | 0 .../StringDateMapDeserializer.java | 0 .../serializationwithexclusions/Exclude.java | 0 .../serializationwithexclusions/MyClass.java | 0 .../MyClassWithAnnotatedFields.java | 0 .../MyClassWithCustomAnnotatedFields.java | 0 .../MyClassWithTransientFields.java | 0 .../MySubClass.java | 0 .../MySubClassWithAnnotatedFields.java | 0 .../MySubClassWithCustomAnnotatedFields.java | 0 .../MySubClassWithTransientFields.java | 0 .../gson}/src/main/resources/logback.xml | 0 .../gson/advance/GsonAdvanceUnitTest.java | 0 .../advance/RuntimeTypeAdapterFactory.java | 0 .../JsonObjectConversionsUnitTest.java | 0 .../baeldung/gson/deserialization/Foo.java | 0 .../gson/deserialization/FooDeserializer.java | 0 ...serializerFromJsonWithDifferentFields.java | 0 .../deserialization/FooInstanceCreator.java | 0 .../gson/deserialization/FooWithInner.java | 0 .../gson/deserialization/GenericFoo.java | 0 .../GsonAlternateUnitTest.java | 0 .../GsonDeserializeUnitTest.java | 0 .../MapDeserializationUnitTest.java | 0 .../test/GsonDeserializationUnitTest.java | 0 .../gson/jsoncompare/JsonCompareUnitTest.java | 0 .../primitives/PrimitiveValuesUnitTest.java | 0 .../DifferentNameSerializer.java | 0 .../serialization/GsonSerializeUnitTest.java | 0 ...ngFieldsNotMatchingCriteriaSerializer.java | 0 .../IgnoringFieldsSerializer.java | 0 .../gson/serialization/SourceClass.java | 0 .../test/GsonSerializationUnitTest.java | 4 +- .../serialization/test/JsonFileUnitTest.java | 0 .../SerializationWithExclusionsUnitTest.java | 0 .../gson}/src/test/resources/.gitignore | 0 .../gson}/src/test/resources/logback-test.xml | 0 {json-2 => json-modules/json-2}/README.md | 0 {json-2 => json-modules/json-2}/pom.xml | 2 +- .../com/baeldung/jsoniter/model/Name.java | 0 .../com/baeldung/jsoniter/model/Student.java | 0 .../baeldung/jsonoptimization/Customer.java | 0 .../CustomerDeserializer.java | 0 .../jsonoptimization/CustomerSerializer.java | 0 .../jsonoptimization/CustomerShortNames.java | 0 .../jsonoptimization/CustomerSlim.java | 0 .../CustomerSlimDeserializer.java | 0 .../CustomerSlimSerializer.java | 0 .../CustomerSlimShortNames.java | 0 .../JsonToJavaClassConversion.java | 0 .../jsontojavaclass/pojo/SamplePojo.java | 0 .../jsonvalidation/GsonValidator.java | 0 .../jsonvalidation/JacksonValidator.java | 0 .../jsonvalidation/JsonValidator.java | 0 .../jsontojavaclass/pojo/Address.java | 0 .../baeldung/jsontojavaclass/pojo/Input.java | 0 .../json-2}/src/main/resources/input.json | 0 .../baeldung/fastjson/FastJsonUnitTest.java | 0 .../java/com/baeldung/fastjson/Person.java | 0 .../jsoniter/JsoniterIntroUnitTest.java | 0 .../JacksonDeserializationUnitTest.java | 0 .../jsonldjava/jackson/Person.java | 0 .../HydraJsonldSerializationUnitTest.java | 0 .../serialization/hydrajsonld/Person.java | 0 .../JacksonJsonLdSerializationUnitTest.java | 0 .../serialization/jacksonjsonld/Person.java | 0 .../JsonOptimizationUnitTest.java | 0 .../JsonToJavaClassConversionUnitTest.java | 0 .../jsonvalidation/GsonValidatorUnitTest.java | 0 .../JacksonValidatorUnitTest.java | 0 .../jsonvalidation/JsonValidatorUnitTest.java | 0 .../moshi/AlternativeAdapterUnitTest.java | 0 .../com/baeldung/moshi/ArrayUnitTest.java | 0 .../moshi/ComplexAdapterUnitTest.java | 0 .../com/baeldung/moshi/DefaultUnitTest.java | 0 .../com/baeldung/moshi/PrimitiveUnitTest.java | 0 .../com/baeldung/moshi/RenameUnitTest.java | 0 .../baeldung/moshi/SimpleAdapterUnitTest.java | 0 .../com/baeldung/moshi/TransientUnitTest.java | 0 .../json-2}/src/test/resources/Student.json | 0 .../jsontojavaclass/pojo/SamplePojo.java | 0 .../json_optimization_mock_data.json | 0 .../src/test/resources/sample_input.json | 0 .../json-path}/.gitignore | 0 .../json-path}/README.md | 0 {json-path => json-modules/json-path}/pom.xml | 2 +- .../src/main/resources/intro_api.json | 0 .../src/main/resources/intro_service.json | 0 .../src/main/resources/intro_user.json | 0 .../json-path}/src/main/resources/logback.xml | 0 .../src/main/resources/online_store.json | 44 ++--- .../introduction/JsonPathUnitTest.java | 92 +++++----- .../OperationIntegrationTest.java | 0 .../introduction/ServiceIntegrationTest.java | 0 .../json-path}/src/test/resources/logback.xml | 0 {json => json-modules/json}/README.md | 0 {json => json-modules/json}/pom.xml | 166 +++++++++--------- .../com/baeldung/adapter/PersonAdapter.java | 0 .../java/com/baeldung/escape/JsonEscape.java | 0 .../main/java/com/baeldung/jsonb/Person.java | 0 .../java/com/baeldung/jsonjava/CDLDemo.java | 0 .../com/baeldung/jsonjava/CookieDemo.java | 0 .../java/com/baeldung/jsonjava/DemoBean.java | 0 .../java/com/baeldung/jsonjava/HTTPDemo.java | 0 .../com/baeldung/jsonjava/JSONArrayDemo.java | 0 .../jsonjava/JSONArrayGetValueByKey.java | 0 .../com/baeldung/jsonjava/JSONObjectDemo.java | 0 .../baeldung/jsonjava/JSONTokenerDemo.java | 0 .../baeldung/jsonjava/ObjectToFromJSON.java | 0 .../iterate/JSONObjectIterator.java | 100 +++++------ .../baeldung/jsonpointer/JsonPointerCrud.java | 0 .../json}/src/main/resources/logback.xml | 0 .../json}/src/main/webapp/index.html | 0 .../json}/src/main/webapp/js/app.js | 0 .../json}/src/main/webapp/js/schema.js | 0 .../json}/src/main/webapp/js/ui-schema.js | 0 .../json}/src/main/webapp/package.json | 20 +-- .../baeldung/escape/JsonEscapeUnitTest.java | 0 .../json/schema/JSONSchemaUnitTest.java | 0 .../com/baeldung/jsonb/JsonbUnitTest.java | 0 .../baeldung/jsonjava/CDLIntegrationTest.java | 0 .../jsonjava/CookieIntegrationTest.java | 0 .../jsonjava/HTTPIntegrationTest.java | 0 .../JSONArrayGetValueByKeyUnitTest.java | 0 .../jsonjava/JSONArrayIntegrationTest.java | 0 .../jsonjava/JSONObjectIntegrationTest.java | 0 .../jsonjava/JSONTokenerIntegrationTest.java | 0 .../ObjectToFromJSONIntegrationTest.java | 0 .../iterate/JSONObjectIteratorUnitTest.java | 158 ++++++++--------- .../jsonpointer/JsonPointerCrudUnitTest.java | 0 .../json}/src/test/resources/address.json | 0 .../json}/src/test/resources/books.json | 0 .../src/test/resources/product_invalid.json | 10 +- .../src/test/resources/product_valid.json | 10 +- .../json}/src/test/resources/schema.json | 44 ++--- json-modules/pom.xml | 36 ++++ pom.xml | 10 +- 163 files changed, 377 insertions(+), 336 deletions(-) create mode 100644 json-modules/README.md rename {gson => json-modules/gson}/.gitignore (100%) rename {gson => json-modules/gson}/README.md (100%) rename {gson => json-modules/gson}/pom.xml (87%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/ActorGson.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/Animal.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/Cow.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/Dog.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/Employee.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/Movie.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/MyClass.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/User.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/entities/Weather.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/CharExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/LongExample.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java (100%) rename {gson => json-modules/gson}/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java (100%) rename {gson => json-modules/gson}/src/main/resources/logback.xml (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/Foo.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/jsoncompare/JsonCompareUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/SourceClass.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java (98%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java (100%) rename {gson => json-modules/gson}/src/test/resources/.gitignore (100%) rename {gson => json-modules/gson}/src/test/resources/logback-test.xml (100%) rename {json-2 => json-modules/json-2}/README.md (100%) rename {json-2 => json-modules/json-2}/pom.xml (99%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsoniter/model/Name.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsoniter/model/Student.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/Customer.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversion.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsontojavaclass/pojo/SamplePojo.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonvalidation/GsonValidator.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonvalidation/JacksonValidator.java (100%) rename {json-2 => json-modules/json-2}/src/main/java/com/baeldung/jsonvalidation/JsonValidator.java (100%) rename {json-2 => json-modules/json-2}/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Address.java (100%) rename {json-2 => json-modules/json-2}/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Input.java (100%) rename {json-2 => json-modules/json-2}/src/main/resources/input.json (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/fastjson/FastJsonUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/fastjson/Person.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsoniter/JsoniterIntroUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversionUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonvalidation/GsonValidatorUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonvalidation/JacksonValidatorUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/jsonvalidation/JsonValidatorUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/AlternativeAdapterUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/ArrayUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/ComplexAdapterUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/DefaultUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/PrimitiveUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/RenameUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/SimpleAdapterUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/java/com/baeldung/moshi/TransientUnitTest.java (100%) rename {json-2 => json-modules/json-2}/src/test/resources/Student.json (100%) rename {json-2 => json-modules/json-2}/src/test/resources/com/baeldung/jsontojavaclass/pojo/SamplePojo.java (100%) rename {json-2 => json-modules/json-2}/src/test/resources/json_optimization_mock_data.json (100%) rename {json-2 => json-modules/json-2}/src/test/resources/sample_input.json (100%) rename {json-path => json-modules/json-path}/.gitignore (100%) rename {json-path => json-modules/json-path}/README.md (100%) rename {json-path => json-modules/json-path}/pom.xml (94%) rename {json-path => json-modules/json-path}/src/main/resources/intro_api.json (100%) rename {json-path => json-modules/json-path}/src/main/resources/intro_service.json (100%) rename {json-path => json-modules/json-path}/src/main/resources/intro_user.json (100%) rename {json-path => json-modules/json-path}/src/main/resources/logback.xml (100%) rename {json-path => json-modules/json-path}/src/main/resources/online_store.json (95%) rename {json-path => json-modules/json-path}/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java (96%) rename {json-path => json-modules/json-path}/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java (100%) rename {json-path => json-modules/json-path}/src/test/java/com/baeldung/jsonpath/introduction/ServiceIntegrationTest.java (100%) rename {json-path => json-modules/json-path}/src/test/resources/logback.xml (100%) rename {json => json-modules/json}/README.md (100%) rename {json => json-modules/json}/pom.xml (95%) rename {json => json-modules/json}/src/main/java/com/baeldung/adapter/PersonAdapter.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/escape/JsonEscape.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonb/Person.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/CDLDemo.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/CookieDemo.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/DemoBean.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/HTTPDemo.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/JSONArrayDemo.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/JSONObjectDemo.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/JSONTokenerDemo.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonjava/ObjectToFromJSON.java (100%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java (96%) rename {json => json-modules/json}/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java (100%) rename {json => json-modules/json}/src/main/resources/logback.xml (100%) rename {json => json-modules/json}/src/main/webapp/index.html (100%) rename {json => json-modules/json}/src/main/webapp/js/app.js (100%) rename {json => json-modules/json}/src/main/webapp/js/schema.js (100%) rename {json => json-modules/json}/src/main/webapp/js/ui-schema.js (100%) rename {json => json-modules/json}/src/main/webapp/package.json (96%) rename {json => json-modules/json}/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/json/schema/JSONSchemaUnitTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonb/JsonbUnitTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/CDLIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/HTTPIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/JSONArrayIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/JSONObjectIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/JSONTokenerIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonjava/ObjectToFromJSONIntegrationTest.java (100%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java (97%) rename {json => json-modules/json}/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java (100%) rename {json => json-modules/json}/src/test/resources/address.json (100%) rename {json => json-modules/json}/src/test/resources/books.json (100%) rename {json => json-modules/json}/src/test/resources/product_invalid.json (91%) rename {json => json-modules/json}/src/test/resources/product_valid.json (92%) rename {json => json-modules/json}/src/test/resources/schema.json (96%) create mode 100644 json-modules/pom.xml diff --git a/json-modules/README.md b/json-modules/README.md new file mode 100644 index 0000000000..a7100c40c8 --- /dev/null +++ b/json-modules/README.md @@ -0,0 +1,3 @@ +## JSON + +This module contains modules about JSON. diff --git a/gson/.gitignore b/json-modules/gson/.gitignore similarity index 100% rename from gson/.gitignore rename to json-modules/gson/.gitignore diff --git a/gson/README.md b/json-modules/gson/README.md similarity index 100% rename from gson/README.md rename to json-modules/gson/README.md diff --git a/gson/pom.xml b/json-modules/gson/pom.xml similarity index 87% rename from gson/pom.xml rename to json-modules/gson/pom.xml index 082e53baf0..bd0b562785 100644 --- a/gson/pom.xml +++ b/json-modules/gson/pom.xml @@ -9,9 +9,8 @@ com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java + json-modules + 1.0.0-SNAPSHOT @@ -42,12 +41,18 @@ commons-lang3 ${commons-lang3.version} + + com.google.guava + guava + ${guava.version} + com.google.code.gson gson ${gson.version} + @@ -63,6 +68,7 @@ 2.8.0 2.9.6 + 11.0.2 \ No newline at end of file diff --git a/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/ActorGson.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/ActorGson.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/Animal.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/Animal.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/Animal.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/Animal.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/Cow.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/Cow.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/Cow.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/Cow.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/Dog.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/Dog.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/Dog.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/Dog.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/Employee.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/Employee.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/Employee.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/Employee.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/Movie.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/Movie.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/Movie.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/Movie.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/MovieWithNullValue.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/MyClass.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/MyClass.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/MyClass.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/MyClass.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/User.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/User.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/User.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/User.java diff --git a/gson/src/main/java/com/baeldung/gson/entities/Weather.java b/json-modules/gson/src/main/java/com/baeldung/gson/entities/Weather.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/entities/Weather.java rename to json-modules/gson/src/main/java/com/baeldung/gson/entities/Weather.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/BooleanExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/ByteExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/CharExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/DoubleExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/FloatExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/InfinityValuesExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/LongExample.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundle.java diff --git a/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java b/json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java rename to json-modules/gson/src/main/java/com/baeldung/gson/primitives/models/PrimitiveBundleInitialized.java diff --git a/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java b/json-modules/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonDeserializer.java diff --git a/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java b/json-modules/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serialization/ActorGsonSerializer.java diff --git a/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java b/json-modules/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serialization/AnimalDeserializer.java diff --git a/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java b/json-modules/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serialization/MapDeserializer.java diff --git a/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java b/json-modules/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serialization/StringDateMapDeserializer.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/Exclude.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClass.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithAnnotatedFields.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithCustomAnnotatedFields.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MyClassWithTransientFields.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClass.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithAnnotatedFields.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithCustomAnnotatedFields.java diff --git a/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java b/json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java similarity index 100% rename from gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java rename to json-modules/gson/src/main/java/com/baeldung/gson/serializationwithexclusions/MySubClassWithTransientFields.java diff --git a/gson/src/main/resources/logback.xml b/json-modules/gson/src/main/resources/logback.xml similarity index 100% rename from gson/src/main/resources/logback.xml rename to json-modules/gson/src/main/resources/logback.xml diff --git a/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/advance/GsonAdvanceUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java b/json-modules/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java rename to json-modules/gson/src/test/java/com/baeldung/gson/advance/RuntimeTypeAdapterFactory.java diff --git a/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/Foo.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/Foo.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializer.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooDeserializerFromJsonWithDifferentFields.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooInstanceCreator.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/FooWithInner.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/GenericFoo.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/GsonAlternateUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/GsonDeserializeUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/MapDeserializationUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/deserialization/test/GsonDeserializationUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/jsoncompare/JsonCompareUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/jsoncompare/JsonCompareUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/jsoncompare/JsonCompareUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/jsoncompare/JsonCompareUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/primitives/PrimitiveValuesUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/DifferentNameSerializer.java diff --git a/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/GsonSerializeUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsNotMatchingCriteriaSerializer.java diff --git a/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/IgnoringFieldsSerializer.java diff --git a/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/SourceClass.java diff --git a/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java similarity index 98% rename from gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java index 4780b8a6bf..3b8912d259 100644 --- a/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java +++ b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/test/GsonSerializationUnitTest.java @@ -11,10 +11,12 @@ import com.baeldung.gson.serialization.DifferentNameSerializer; import com.baeldung.gson.serialization.IgnoringFieldsNotMatchingCriteriaSerializer; import com.baeldung.gson.serialization.IgnoringFieldsSerializer; import com.baeldung.gson.serialization.SourceClass; + +import org.assertj.core.util.Lists; import org.joda.time.DateTime; import org.junit.Test; -import com.google.common.collect.Lists; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; diff --git a/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serialization/test/JsonFileUnitTest.java diff --git a/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java b/json-modules/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java similarity index 100% rename from gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java rename to json-modules/gson/src/test/java/com/baeldung/gson/serializationwithexclusions/SerializationWithExclusionsUnitTest.java diff --git a/gson/src/test/resources/.gitignore b/json-modules/gson/src/test/resources/.gitignore similarity index 100% rename from gson/src/test/resources/.gitignore rename to json-modules/gson/src/test/resources/.gitignore diff --git a/gson/src/test/resources/logback-test.xml b/json-modules/gson/src/test/resources/logback-test.xml similarity index 100% rename from gson/src/test/resources/logback-test.xml rename to json-modules/gson/src/test/resources/logback-test.xml diff --git a/json-2/README.md b/json-modules/json-2/README.md similarity index 100% rename from json-2/README.md rename to json-modules/json-2/README.md diff --git a/json-2/pom.xml b/json-modules/json-2/pom.xml similarity index 99% rename from json-2/pom.xml rename to json-modules/json-2/pom.xml index 6fbdebc953..5a820978a7 100644 --- a/json-2/pom.xml +++ b/json-modules/json-2/pom.xml @@ -9,7 +9,7 @@ com.baeldung - parent-modules + json-modules 1.0.0-SNAPSHOT diff --git a/json-2/src/main/java/com/baeldung/jsoniter/model/Name.java b/json-modules/json-2/src/main/java/com/baeldung/jsoniter/model/Name.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsoniter/model/Name.java rename to json-modules/json-2/src/main/java/com/baeldung/jsoniter/model/Name.java diff --git a/json-2/src/main/java/com/baeldung/jsoniter/model/Student.java b/json-modules/json-2/src/main/java/com/baeldung/jsoniter/model/Student.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsoniter/model/Student.java rename to json-modules/json-2/src/main/java/com/baeldung/jsoniter/model/Student.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java b/json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java diff --git a/json-2/src/main/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversion.java b/json-modules/json-2/src/main/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversion.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversion.java rename to json-modules/json-2/src/main/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversion.java diff --git a/json-2/src/main/java/com/baeldung/jsontojavaclass/pojo/SamplePojo.java b/json-modules/json-2/src/main/java/com/baeldung/jsontojavaclass/pojo/SamplePojo.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsontojavaclass/pojo/SamplePojo.java rename to json-modules/json-2/src/main/java/com/baeldung/jsontojavaclass/pojo/SamplePojo.java diff --git a/json-2/src/main/java/com/baeldung/jsonvalidation/GsonValidator.java b/json-modules/json-2/src/main/java/com/baeldung/jsonvalidation/GsonValidator.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonvalidation/GsonValidator.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonvalidation/GsonValidator.java diff --git a/json-2/src/main/java/com/baeldung/jsonvalidation/JacksonValidator.java b/json-modules/json-2/src/main/java/com/baeldung/jsonvalidation/JacksonValidator.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonvalidation/JacksonValidator.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonvalidation/JacksonValidator.java diff --git a/json-2/src/main/java/com/baeldung/jsonvalidation/JsonValidator.java b/json-modules/json-2/src/main/java/com/baeldung/jsonvalidation/JsonValidator.java similarity index 100% rename from json-2/src/main/java/com/baeldung/jsonvalidation/JsonValidator.java rename to json-modules/json-2/src/main/java/com/baeldung/jsonvalidation/JsonValidator.java diff --git a/json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Address.java b/json-modules/json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Address.java similarity index 100% rename from json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Address.java rename to json-modules/json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Address.java diff --git a/json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Input.java b/json-modules/json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Input.java similarity index 100% rename from json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Input.java rename to json-modules/json-2/src/main/resources/convertedPojo/com/baeldung/jsontojavaclass/pojo/Input.java diff --git a/json-2/src/main/resources/input.json b/json-modules/json-2/src/main/resources/input.json similarity index 100% rename from json-2/src/main/resources/input.json rename to json-modules/json-2/src/main/resources/input.json diff --git a/json-2/src/test/java/com/baeldung/fastjson/FastJsonUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/fastjson/FastJsonUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/fastjson/FastJsonUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/fastjson/FastJsonUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/fastjson/Person.java b/json-modules/json-2/src/test/java/com/baeldung/fastjson/Person.java similarity index 100% rename from json-2/src/test/java/com/baeldung/fastjson/Person.java rename to json-modules/json-2/src/test/java/com/baeldung/fastjson/Person.java diff --git a/json-2/src/test/java/com/baeldung/jsoniter/JsoniterIntroUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsoniter/JsoniterIntroUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsoniter/JsoniterIntroUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsoniter/JsoniterIntroUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java b/json-modules/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java b/json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java b/json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java diff --git a/json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversionUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversionUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversionUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsontojavaclass/JsonToJavaClassConversionUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonvalidation/GsonValidatorUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonvalidation/GsonValidatorUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonvalidation/GsonValidatorUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonvalidation/GsonValidatorUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonvalidation/JacksonValidatorUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonvalidation/JacksonValidatorUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonvalidation/JacksonValidatorUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonvalidation/JacksonValidatorUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/jsonvalidation/JsonValidatorUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/jsonvalidation/JsonValidatorUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/jsonvalidation/JsonValidatorUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/jsonvalidation/JsonValidatorUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/AlternativeAdapterUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/AlternativeAdapterUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/AlternativeAdapterUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/AlternativeAdapterUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/ArrayUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/ArrayUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/ArrayUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/ArrayUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/ComplexAdapterUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/ComplexAdapterUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/ComplexAdapterUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/ComplexAdapterUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/DefaultUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/DefaultUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/DefaultUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/DefaultUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/PrimitiveUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/PrimitiveUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/PrimitiveUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/PrimitiveUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/RenameUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/RenameUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/RenameUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/RenameUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/SimpleAdapterUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/SimpleAdapterUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/SimpleAdapterUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/SimpleAdapterUnitTest.java diff --git a/json-2/src/test/java/com/baeldung/moshi/TransientUnitTest.java b/json-modules/json-2/src/test/java/com/baeldung/moshi/TransientUnitTest.java similarity index 100% rename from json-2/src/test/java/com/baeldung/moshi/TransientUnitTest.java rename to json-modules/json-2/src/test/java/com/baeldung/moshi/TransientUnitTest.java diff --git a/json-2/src/test/resources/Student.json b/json-modules/json-2/src/test/resources/Student.json similarity index 100% rename from json-2/src/test/resources/Student.json rename to json-modules/json-2/src/test/resources/Student.json diff --git a/json-2/src/test/resources/com/baeldung/jsontojavaclass/pojo/SamplePojo.java b/json-modules/json-2/src/test/resources/com/baeldung/jsontojavaclass/pojo/SamplePojo.java similarity index 100% rename from json-2/src/test/resources/com/baeldung/jsontojavaclass/pojo/SamplePojo.java rename to json-modules/json-2/src/test/resources/com/baeldung/jsontojavaclass/pojo/SamplePojo.java diff --git a/json-2/src/test/resources/json_optimization_mock_data.json b/json-modules/json-2/src/test/resources/json_optimization_mock_data.json similarity index 100% rename from json-2/src/test/resources/json_optimization_mock_data.json rename to json-modules/json-2/src/test/resources/json_optimization_mock_data.json diff --git a/json-2/src/test/resources/sample_input.json b/json-modules/json-2/src/test/resources/sample_input.json similarity index 100% rename from json-2/src/test/resources/sample_input.json rename to json-modules/json-2/src/test/resources/sample_input.json diff --git a/json-path/.gitignore b/json-modules/json-path/.gitignore similarity index 100% rename from json-path/.gitignore rename to json-modules/json-path/.gitignore diff --git a/json-path/README.md b/json-modules/json-path/README.md similarity index 100% rename from json-path/README.md rename to json-modules/json-path/README.md diff --git a/json-path/pom.xml b/json-modules/json-path/pom.xml similarity index 94% rename from json-path/pom.xml rename to json-modules/json-path/pom.xml index b4577ec15f..e467ee9557 100644 --- a/json-path/pom.xml +++ b/json-modules/json-path/pom.xml @@ -9,7 +9,7 @@ com.baeldung - parent-modules + json-modules 1.0.0-SNAPSHOT diff --git a/json-path/src/main/resources/intro_api.json b/json-modules/json-path/src/main/resources/intro_api.json similarity index 100% rename from json-path/src/main/resources/intro_api.json rename to json-modules/json-path/src/main/resources/intro_api.json diff --git a/json-path/src/main/resources/intro_service.json b/json-modules/json-path/src/main/resources/intro_service.json similarity index 100% rename from json-path/src/main/resources/intro_service.json rename to json-modules/json-path/src/main/resources/intro_service.json diff --git a/json-path/src/main/resources/intro_user.json b/json-modules/json-path/src/main/resources/intro_user.json similarity index 100% rename from json-path/src/main/resources/intro_user.json rename to json-modules/json-path/src/main/resources/intro_user.json diff --git a/json-path/src/main/resources/logback.xml b/json-modules/json-path/src/main/resources/logback.xml similarity index 100% rename from json-path/src/main/resources/logback.xml rename to json-modules/json-path/src/main/resources/logback.xml diff --git a/json-path/src/main/resources/online_store.json b/json-modules/json-path/src/main/resources/online_store.json similarity index 95% rename from json-path/src/main/resources/online_store.json rename to json-modules/json-path/src/main/resources/online_store.json index c0ddf274d8..2b271a1124 100644 --- a/json-path/src/main/resources/online_store.json +++ b/json-modules/json-path/src/main/resources/online_store.json @@ -1,23 +1,23 @@ -{ - "items":{ - "book":[ - { - "author":"Arthur Conan Doyle", - "title":"Sherlock Holmes", - "price":8.99 - }, - { - "author":"J. R. R. Tolkien", - "title":"The Lord of the Rings", - "isbn":"0-395-19395-8", - "price":22.99 - } - ], - "bicycle":{ - "color":"red", - "price":19.95 - } - }, - "url":"mystore.com", - "owner":"baeldung" +{ + "items":{ + "book":[ + { + "author":"Arthur Conan Doyle", + "title":"Sherlock Holmes", + "price":8.99 + }, + { + "author":"J. R. R. Tolkien", + "title":"The Lord of the Rings", + "isbn":"0-395-19395-8", + "price":22.99 + } + ], + "bicycle":{ + "color":"red", + "price":19.95 + } + }, + "url":"mystore.com", + "owner":"baeldung" } \ No newline at end of file diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java b/json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java similarity index 96% rename from json-path/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java rename to json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java index 3408629a6d..9ffe027b6f 100644 --- a/json-path/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java +++ b/json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/JsonPathUnitTest.java @@ -1,46 +1,46 @@ -package com.baeldung.jsonpath.introduction; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.Map; - -import org.junit.BeforeClass; -import org.junit.Test; - -import com.jayway.jsonpath.JsonPath; - -import net.minidev.json.JSONArray; - -public class JsonPathUnitTest { - - private static String json; - private static File jsonFile = new File("src/main/resources/online_store.json"); - - private static String readFile(File file, Charset charset) throws IOException { - return new String(Files.readAllBytes(file.toPath()), charset); - } - - @BeforeClass - public static void init() throws IOException { - json = readFile(jsonFile, StandardCharsets.UTF_8); - } - - @Test - public void shouldMatchCountOfObjects() { - Map objectMap = JsonPath.read(json, "$"); - assertEquals(3, objectMap.keySet() - .size()); - } - - @Test - public void shouldMatchCountOfArrays() { - JSONArray jsonArray = JsonPath.read(json, "$.items.book[*]"); - assertEquals(2, jsonArray.size()); - } - -} +package com.baeldung.jsonpath.introduction; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Map; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jayway.jsonpath.JsonPath; + +import net.minidev.json.JSONArray; + +public class JsonPathUnitTest { + + private static String json; + private static File jsonFile = new File("src/main/resources/online_store.json"); + + private static String readFile(File file, Charset charset) throws IOException { + return new String(Files.readAllBytes(file.toPath()), charset); + } + + @BeforeClass + public static void init() throws IOException { + json = readFile(jsonFile, StandardCharsets.UTF_8); + } + + @Test + public void shouldMatchCountOfObjects() { + Map objectMap = JsonPath.read(json, "$"); + assertEquals(3, objectMap.keySet() + .size()); + } + + @Test + public void shouldMatchCountOfArrays() { + JSONArray jsonArray = JsonPath.read(json, "$.items.book[*]"); + assertEquals(2, jsonArray.size()); + } + +} diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java b/json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java similarity index 100% rename from json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java rename to json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceIntegrationTest.java b/json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceIntegrationTest.java similarity index 100% rename from json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceIntegrationTest.java rename to json-modules/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceIntegrationTest.java diff --git a/json-path/src/test/resources/logback.xml b/json-modules/json-path/src/test/resources/logback.xml similarity index 100% rename from json-path/src/test/resources/logback.xml rename to json-modules/json-path/src/test/resources/logback.xml diff --git a/json/README.md b/json-modules/json/README.md similarity index 100% rename from json/README.md rename to json-modules/json/README.md diff --git a/json/pom.xml b/json-modules/json/pom.xml similarity index 95% rename from json/pom.xml rename to json-modules/json/pom.xml index 87bbad460a..04a00598a3 100644 --- a/json/pom.xml +++ b/json-modules/json/pom.xml @@ -1,84 +1,84 @@ - - - 4.0.0 - org.baeldung - json - 0.0.1-SNAPSHOT - json - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.everit.json - org.everit.json.schema - ${everit.json.schema.version} - - - commons-logging - commons-logging - - - - - org.json - json - ${json.version} - - - com.google.code.gson - gson - ${gson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - javax.json.bind - javax.json.bind-api - ${jsonb-api.version} - - - org.glassfish - javax.json - ${javax.version} - - - org.eclipse - yasson - ${yasson.version} - - - - org.apache.commons - commons-collections4 - ${commons-collections4.version} - test - - - net.javacrumbs.json-unit - json-unit-assertj - ${json-unit-assertj.version} - test - - - - - 1.4.1 - 1.0 - 1.0.1 - 20211205 - 2.8.5 - 1.1.2 - 2.28.0 - - + + + 4.0.0 + org.baeldung + json + 0.0.1-SNAPSHOT + json + + + com.baeldung + json-modules + 1.0.0-SNAPSHOT + + + + + org.everit.json + org.everit.json.schema + ${everit.json.schema.version} + + + commons-logging + commons-logging + + + + + org.json + json + ${json.version} + + + com.google.code.gson + gson + ${gson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + javax.json.bind + javax.json.bind-api + ${jsonb-api.version} + + + org.glassfish + javax.json + ${javax.version} + + + org.eclipse + yasson + ${yasson.version} + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + test + + + net.javacrumbs.json-unit + json-unit-assertj + ${json-unit-assertj.version} + test + + + + + 1.4.1 + 1.0 + 1.0.1 + 20211205 + 2.8.5 + 1.1.2 + 2.28.0 + + \ No newline at end of file diff --git a/json/src/main/java/com/baeldung/adapter/PersonAdapter.java b/json-modules/json/src/main/java/com/baeldung/adapter/PersonAdapter.java similarity index 100% rename from json/src/main/java/com/baeldung/adapter/PersonAdapter.java rename to json-modules/json/src/main/java/com/baeldung/adapter/PersonAdapter.java diff --git a/json/src/main/java/com/baeldung/escape/JsonEscape.java b/json-modules/json/src/main/java/com/baeldung/escape/JsonEscape.java similarity index 100% rename from json/src/main/java/com/baeldung/escape/JsonEscape.java rename to json-modules/json/src/main/java/com/baeldung/escape/JsonEscape.java diff --git a/json/src/main/java/com/baeldung/jsonb/Person.java b/json-modules/json/src/main/java/com/baeldung/jsonb/Person.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonb/Person.java rename to json-modules/json/src/main/java/com/baeldung/jsonb/Person.java diff --git a/json/src/main/java/com/baeldung/jsonjava/CDLDemo.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/CDLDemo.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/CDLDemo.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/CDLDemo.java diff --git a/json/src/main/java/com/baeldung/jsonjava/CookieDemo.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/CookieDemo.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/CookieDemo.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/CookieDemo.java diff --git a/json/src/main/java/com/baeldung/jsonjava/DemoBean.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/DemoBean.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/DemoBean.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/DemoBean.java diff --git a/json/src/main/java/com/baeldung/jsonjava/HTTPDemo.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/HTTPDemo.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/HTTPDemo.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/HTTPDemo.java diff --git a/json/src/main/java/com/baeldung/jsonjava/JSONArrayDemo.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/JSONArrayDemo.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/JSONArrayDemo.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/JSONArrayDemo.java diff --git a/json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/JSONArrayGetValueByKey.java diff --git a/json/src/main/java/com/baeldung/jsonjava/JSONObjectDemo.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/JSONObjectDemo.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/JSONObjectDemo.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/JSONObjectDemo.java diff --git a/json/src/main/java/com/baeldung/jsonjava/JSONTokenerDemo.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/JSONTokenerDemo.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/JSONTokenerDemo.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/JSONTokenerDemo.java diff --git a/json/src/main/java/com/baeldung/jsonjava/ObjectToFromJSON.java b/json-modules/json/src/main/java/com/baeldung/jsonjava/ObjectToFromJSON.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonjava/ObjectToFromJSON.java rename to json-modules/json/src/main/java/com/baeldung/jsonjava/ObjectToFromJSON.java diff --git a/json/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java b/json-modules/json/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java similarity index 96% rename from json/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java rename to json-modules/json/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java index 0ff8650652..0d3ae3b021 100644 --- a/json/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java +++ b/json-modules/json/src/main/java/com/baeldung/jsonobject/iterate/JSONObjectIterator.java @@ -1,50 +1,50 @@ -package com.baeldung.jsonobject.iterate; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.json.JSONArray; -import org.json.JSONObject; - -public class JSONObjectIterator { - - private Map keyValuePairs; - - public JSONObjectIterator() { - keyValuePairs = new HashMap<>(); - } - - public void handleValue(String key, Object value) { - if (value instanceof JSONArray) { - handleJSONArray(key, (JSONArray) value); - } else if (value instanceof JSONObject) { - handleJSONObject((JSONObject) value); - } - keyValuePairs.put(key, value); - } - - public void handleJSONObject(JSONObject jsonObject) { - Iterator jsonObjectIterator = jsonObject.keys(); - jsonObjectIterator.forEachRemaining(key -> { - Object value = jsonObject.get(key); - handleValue(key, value); - }); - } - - public void handleJSONArray(String key, JSONArray jsonArray) { - Iterator jsonArrayIterator = jsonArray.iterator(); - jsonArrayIterator.forEachRemaining(element -> { - handleValue(key, element); - }); - } - - public Map getKeyValuePairs() { - return keyValuePairs; - } - - public void setKeyValuePairs(Map keyValuePairs) { - this.keyValuePairs = keyValuePairs; - } - -} +package com.baeldung.jsonobject.iterate; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.json.JSONArray; +import org.json.JSONObject; + +public class JSONObjectIterator { + + private Map keyValuePairs; + + public JSONObjectIterator() { + keyValuePairs = new HashMap<>(); + } + + public void handleValue(String key, Object value) { + if (value instanceof JSONArray) { + handleJSONArray(key, (JSONArray) value); + } else if (value instanceof JSONObject) { + handleJSONObject((JSONObject) value); + } + keyValuePairs.put(key, value); + } + + public void handleJSONObject(JSONObject jsonObject) { + Iterator jsonObjectIterator = jsonObject.keys(); + jsonObjectIterator.forEachRemaining(key -> { + Object value = jsonObject.get(key); + handleValue(key, value); + }); + } + + public void handleJSONArray(String key, JSONArray jsonArray) { + Iterator jsonArrayIterator = jsonArray.iterator(); + jsonArrayIterator.forEachRemaining(element -> { + handleValue(key, element); + }); + } + + public Map getKeyValuePairs() { + return keyValuePairs; + } + + public void setKeyValuePairs(Map keyValuePairs) { + this.keyValuePairs = keyValuePairs; + } + +} diff --git a/json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java b/json-modules/json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java similarity index 100% rename from json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java rename to json-modules/json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java diff --git a/json/src/main/resources/logback.xml b/json-modules/json/src/main/resources/logback.xml similarity index 100% rename from json/src/main/resources/logback.xml rename to json-modules/json/src/main/resources/logback.xml diff --git a/json/src/main/webapp/index.html b/json-modules/json/src/main/webapp/index.html similarity index 100% rename from json/src/main/webapp/index.html rename to json-modules/json/src/main/webapp/index.html diff --git a/json/src/main/webapp/js/app.js b/json-modules/json/src/main/webapp/js/app.js similarity index 100% rename from json/src/main/webapp/js/app.js rename to json-modules/json/src/main/webapp/js/app.js diff --git a/json/src/main/webapp/js/schema.js b/json-modules/json/src/main/webapp/js/schema.js similarity index 100% rename from json/src/main/webapp/js/schema.js rename to json-modules/json/src/main/webapp/js/schema.js diff --git a/json/src/main/webapp/js/ui-schema.js b/json-modules/json/src/main/webapp/js/ui-schema.js similarity index 100% rename from json/src/main/webapp/js/ui-schema.js rename to json-modules/json/src/main/webapp/js/ui-schema.js diff --git a/json/src/main/webapp/package.json b/json-modules/json/src/main/webapp/package.json similarity index 96% rename from json/src/main/webapp/package.json rename to json-modules/json/src/main/webapp/package.json index 2f2d6c9ffa..5dae000593 100644 --- a/json/src/main/webapp/package.json +++ b/json-modules/json/src/main/webapp/package.json @@ -1,11 +1,11 @@ -{ - "name": "jsonforms-intro", - "description": "Introduction to JSONForms", - "version": "0.0.1", - "license": "MIT", - "dependencies": { - "typings": "0.6.5", - "jsonforms": "0.0.19", - "bootstrap": "3.3.6" - } +{ + "name": "jsonforms-intro", + "description": "Introduction to JSONForms", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "typings": "0.6.5", + "jsonforms": "0.0.19", + "bootstrap": "3.3.6" + } } \ No newline at end of file diff --git a/json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java b/json-modules/json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java similarity index 100% rename from json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java rename to json-modules/json/src/test/java/com/baeldung/escape/JsonEscapeUnitTest.java diff --git a/json/src/test/java/com/baeldung/json/schema/JSONSchemaUnitTest.java b/json-modules/json/src/test/java/com/baeldung/json/schema/JSONSchemaUnitTest.java similarity index 100% rename from json/src/test/java/com/baeldung/json/schema/JSONSchemaUnitTest.java rename to json-modules/json/src/test/java/com/baeldung/json/schema/JSONSchemaUnitTest.java diff --git a/json/src/test/java/com/baeldung/jsonb/JsonbUnitTest.java b/json-modules/json/src/test/java/com/baeldung/jsonb/JsonbUnitTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonb/JsonbUnitTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonb/JsonbUnitTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/CDLIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/CDLIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/CDLIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/CDLIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/CookieIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/HTTPIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/HTTPIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/HTTPIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/HTTPIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/JSONArrayGetValueByKeyUnitTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/JSONArrayIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/JSONArrayIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/JSONArrayIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/JSONArrayIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/JSONObjectIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/JSONObjectIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/JSONObjectIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/JSONObjectIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/JSONTokenerIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/JSONTokenerIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/JSONTokenerIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/JSONTokenerIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonjava/ObjectToFromJSONIntegrationTest.java b/json-modules/json/src/test/java/com/baeldung/jsonjava/ObjectToFromJSONIntegrationTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonjava/ObjectToFromJSONIntegrationTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonjava/ObjectToFromJSONIntegrationTest.java diff --git a/json/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java b/json-modules/json/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java similarity index 97% rename from json/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java index 55cfdab53b..fa51c83e04 100644 --- a/json/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java +++ b/json-modules/json/src/test/java/com/baeldung/jsonobject/iterate/JSONObjectIteratorUnitTest.java @@ -1,79 +1,79 @@ -package com.baeldung.jsonobject.iterate; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Map; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; - -public class JSONObjectIteratorUnitTest { - - private JSONObjectIterator jsonObjectIterator = new JSONObjectIterator(); - - @Test - public void givenJSONObject_whenIterating_thenGetKeyValuePairs() { - JSONObject jsonObject = getJsonObject(); - - jsonObjectIterator.handleJSONObject(jsonObject); - - Map keyValuePairs = jsonObjectIterator.getKeyValuePairs(); - assertThat(keyValuePairs.get("rType")).isEqualTo("Regular"); - assertThat(keyValuePairs.get("rId")).isEqualTo("1001"); - assertThat(keyValuePairs.get("cType")).isEqualTo("Chocolate"); - assertThat(keyValuePairs.get("cId")).isEqualTo("1002"); - assertThat(keyValuePairs.get("bType")).isEqualTo("BlueBerry"); - assertThat(keyValuePairs.get("bId")).isEqualTo("1003"); - assertThat(keyValuePairs.get("name")).isEqualTo("Cake"); - assertThat(keyValuePairs.get("cakeId")).isEqualTo("0001"); - assertThat(keyValuePairs.get("type")).isEqualTo("donut"); - assertThat(keyValuePairs.get("Type")).isEqualTo("Maple"); - assertThat(keyValuePairs.get("tId")).isEqualTo("5001"); - assertThat(keyValuePairs.get("batters") - .toString()).isEqualTo("[{\"rType\":\"Regular\",\"rId\":\"1001\"},{\"cType\":\"Chocolate\",\"cId\":\"1002\"},{\"bType\":\"BlueBerry\",\"bId\":\"1003\"}]"); - assertThat(keyValuePairs.get("cakeShapes") - .toString()).isEqualTo("[\"square\",\"circle\",\"heart\"]"); - assertThat(keyValuePairs.get("topping") - .toString()).isEqualTo("{\"Type\":\"Maple\",\"tId\":\"5001\"}"); - } - - private JSONObject getJsonObject() { - JSONObject cake = new JSONObject(); - cake.put("cakeId", "0001"); - cake.put("type", "donut"); - cake.put("name", "Cake"); - - JSONArray batters = new JSONArray(); - JSONObject regular = new JSONObject(); - regular.put("rId", "1001"); - regular.put("rType", "Regular"); - batters.put(regular); - JSONObject chocolate = new JSONObject(); - chocolate.put("cId", "1002"); - chocolate.put("cType", "Chocolate"); - batters.put(chocolate); - JSONObject blueberry = new JSONObject(); - blueberry.put("bId", "1003"); - blueberry.put("bType", "BlueBerry"); - batters.put(blueberry); - - JSONArray cakeShapes = new JSONArray(); - cakeShapes.put("square"); - cakeShapes.put("circle"); - cakeShapes.put("heart"); - - cake.put("cakeShapes", cakeShapes); - - cake.put("batters", batters); - - JSONObject topping = new JSONObject(); - topping.put("tId", "5001"); - topping.put("Type", "Maple"); - - cake.put("topping", topping); - - return cake; - } - -} +package com.baeldung.jsonobject.iterate; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Map; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Test; + +public class JSONObjectIteratorUnitTest { + + private JSONObjectIterator jsonObjectIterator = new JSONObjectIterator(); + + @Test + public void givenJSONObject_whenIterating_thenGetKeyValuePairs() { + JSONObject jsonObject = getJsonObject(); + + jsonObjectIterator.handleJSONObject(jsonObject); + + Map keyValuePairs = jsonObjectIterator.getKeyValuePairs(); + assertThat(keyValuePairs.get("rType")).isEqualTo("Regular"); + assertThat(keyValuePairs.get("rId")).isEqualTo("1001"); + assertThat(keyValuePairs.get("cType")).isEqualTo("Chocolate"); + assertThat(keyValuePairs.get("cId")).isEqualTo("1002"); + assertThat(keyValuePairs.get("bType")).isEqualTo("BlueBerry"); + assertThat(keyValuePairs.get("bId")).isEqualTo("1003"); + assertThat(keyValuePairs.get("name")).isEqualTo("Cake"); + assertThat(keyValuePairs.get("cakeId")).isEqualTo("0001"); + assertThat(keyValuePairs.get("type")).isEqualTo("donut"); + assertThat(keyValuePairs.get("Type")).isEqualTo("Maple"); + assertThat(keyValuePairs.get("tId")).isEqualTo("5001"); + assertThat(keyValuePairs.get("batters") + .toString()).isEqualTo("[{\"rType\":\"Regular\",\"rId\":\"1001\"},{\"cType\":\"Chocolate\",\"cId\":\"1002\"},{\"bType\":\"BlueBerry\",\"bId\":\"1003\"}]"); + assertThat(keyValuePairs.get("cakeShapes") + .toString()).isEqualTo("[\"square\",\"circle\",\"heart\"]"); + assertThat(keyValuePairs.get("topping") + .toString()).isEqualTo("{\"Type\":\"Maple\",\"tId\":\"5001\"}"); + } + + private JSONObject getJsonObject() { + JSONObject cake = new JSONObject(); + cake.put("cakeId", "0001"); + cake.put("type", "donut"); + cake.put("name", "Cake"); + + JSONArray batters = new JSONArray(); + JSONObject regular = new JSONObject(); + regular.put("rId", "1001"); + regular.put("rType", "Regular"); + batters.put(regular); + JSONObject chocolate = new JSONObject(); + chocolate.put("cId", "1002"); + chocolate.put("cType", "Chocolate"); + batters.put(chocolate); + JSONObject blueberry = new JSONObject(); + blueberry.put("bId", "1003"); + blueberry.put("bType", "BlueBerry"); + batters.put(blueberry); + + JSONArray cakeShapes = new JSONArray(); + cakeShapes.put("square"); + cakeShapes.put("circle"); + cakeShapes.put("heart"); + + cake.put("cakeShapes", cakeShapes); + + cake.put("batters", batters); + + JSONObject topping = new JSONObject(); + topping.put("tId", "5001"); + topping.put("Type", "Maple"); + + cake.put("topping", topping); + + return cake; + } + +} diff --git a/json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java b/json-modules/json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java similarity index 100% rename from json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java rename to json-modules/json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java diff --git a/json/src/test/resources/address.json b/json-modules/json/src/test/resources/address.json similarity index 100% rename from json/src/test/resources/address.json rename to json-modules/json/src/test/resources/address.json diff --git a/json/src/test/resources/books.json b/json-modules/json/src/test/resources/books.json similarity index 100% rename from json/src/test/resources/books.json rename to json-modules/json/src/test/resources/books.json diff --git a/json/src/test/resources/product_invalid.json b/json-modules/json/src/test/resources/product_invalid.json similarity index 91% rename from json/src/test/resources/product_invalid.json rename to json-modules/json/src/test/resources/product_invalid.json index 7c55d8c7a5..96d792aca8 100644 --- a/json/src/test/resources/product_invalid.json +++ b/json-modules/json/src/test/resources/product_invalid.json @@ -1,5 +1,5 @@ -{ - "id": 1, - "name": "Lampshade", - "price": 0 -} +{ + "id": 1, + "name": "Lampshade", + "price": 0 +} diff --git a/json/src/test/resources/product_valid.json b/json-modules/json/src/test/resources/product_valid.json similarity index 92% rename from json/src/test/resources/product_valid.json rename to json-modules/json/src/test/resources/product_valid.json index e0697dc4c2..5095029d4c 100644 --- a/json/src/test/resources/product_valid.json +++ b/json-modules/json/src/test/resources/product_valid.json @@ -1,5 +1,5 @@ -{ - "id": 1, - "name": "Lampshade", - "price": 10 -} +{ + "id": 1, + "name": "Lampshade", + "price": 10 +} diff --git a/json/src/test/resources/schema.json b/json-modules/json/src/test/resources/schema.json similarity index 96% rename from json/src/test/resources/schema.json rename to json-modules/json/src/test/resources/schema.json index 7cf99d76e0..ce513f82c4 100644 --- a/json/src/test/resources/schema.json +++ b/json-modules/json/src/test/resources/schema.json @@ -1,22 +1,22 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Product", - "description": "A product from the catalog", - "type": "object", - "properties": { - "id": { - "description": "The unique identifier for a product", - "type": "integer" - }, - "name": { - "description": "Name of the product", - "type": "string" - }, - "price": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } - }, - "required": ["id", "name", "price"] -} +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Product", + "description": "A product from the catalog", + "type": "object", + "properties": { + "id": { + "description": "The unique identifier for a product", + "type": "integer" + }, + "name": { + "description": "Name of the product", + "type": "string" + }, + "price": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + } + }, + "required": ["id", "name", "price"] +} diff --git a/json-modules/pom.xml b/json-modules/pom.xml new file mode 100644 index 0000000000..6d18738a51 --- /dev/null +++ b/json-modules/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + json-modules + 1.0.0-SNAPSHOT + json-modules + pom + + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + + + + json + json-2 + json-path + gson + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4b96a48fc0..a486b0d17c 100644 --- a/pom.xml +++ b/pom.xml @@ -404,7 +404,6 @@ graphql-modules grpc - gson guava-modules guice @@ -447,9 +446,7 @@ java-native jooby jsf - json - json-2 - json-path + json-modules jsoup kubernetes ksqldb @@ -844,7 +841,6 @@ graphql-modules grpc - gson guava-modules guice @@ -887,9 +883,7 @@ java-native jooby jsf - json - json-2 - json-path + json-modules jsoup ksqldb