outList = gson.fromJson(inputString, listOfAnimals);
+
+ assertEquals(2, outList.size());
+ assertTrue(outList.get(0) instanceof Dog);
+ assertTrue(outList.get(1) instanceof Cow);
+ }
+}
\ No newline at end of file
diff --git a/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java b/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java
new file mode 100644
index 0000000000..739dd889c7
--- /dev/null
+++ b/gson/src/test/java/org/baeldung/gson/advance/RuntimeTypeAdapterFactory.java
@@ -0,0 +1,265 @@
+package org.baeldung.gson.advance;
+
+/*
+ * Copyright (C) 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.internal.Streams;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+
+/**
+ * Adapts values whose runtime type may differ from their declaration type. This
+ * is necessary when a field's type is not the same type that GSON should create
+ * when deserializing that field. For example, consider these types:
+ * {@code
+ * abstract class Shape {
+ * int x;
+ * int y;
+ * }
+ * class Circle extends Shape {
+ * int radius;
+ * }
+ * class Rectangle extends Shape {
+ * int width;
+ * int height;
+ * }
+ * class Diamond extends Shape {
+ * int width;
+ * int height;
+ * }
+ * class Drawing {
+ * Shape bottomShape;
+ * Shape topShape;
+ * }
+ * }
+ * Without additional type information, the serialized JSON is ambiguous. Is
+ * the bottom shape in this drawing a rectangle or a diamond?
{@code
+ * {
+ * "bottomShape": {
+ * "width": 10,
+ * "height": 5,
+ * "x": 0,
+ * "y": 0
+ * },
+ * "topShape": {
+ * "radius": 2,
+ * "x": 4,
+ * "y": 1
+ * }
+ * }}
+ * This class addresses this problem by adding type information to the
+ * serialized JSON and honoring that type information when the JSON is
+ * deserialized: {@code
+ * {
+ * "bottomShape": {
+ * "type": "Diamond",
+ * "width": 10,
+ * "height": 5,
+ * "x": 0,
+ * "y": 0
+ * },
+ * "topShape": {
+ * "type": "Circle",
+ * "radius": 2,
+ * "x": 4,
+ * "y": 1
+ * }
+ * }}
+ * Both the type field name ({@code "type"}) and the type labels ({@code
+ * "Rectangle"}) are configurable.
+ *
+ * Registering Types
+ * Create a {@code RuntimeTypeAdapterFactory} by passing the base type and type field
+ * name to the {@link #of} factory method. If you don't supply an explicit type
+ * field name, {@code "type"} will be used. {@code
+ * RuntimeTypeAdapterFactory shapeAdapterFactory
+ * = RuntimeTypeAdapterFactory.of(Shape.class, "type");
+ * }
+ * Next register all of your subtypes. Every subtype must be explicitly
+ * registered. This protects your application from injection attacks. If you
+ * don't supply an explicit type label, the type's simple name will be used.
+ * {@code
+ * shapeAdapterFactory.registerSubtype(Rectangle.class, "Rectangle");
+ * shapeAdapterFactory.registerSubtype(Circle.class, "Circle");
+ * shapeAdapterFactory.registerSubtype(Diamond.class, "Diamond");
+ * }
+ * Finally, register the type adapter factory in your application's GSON builder:
+ * {@code
+ * Gson gson = new GsonBuilder()
+ * .registerTypeAdapterFactory(shapeAdapterFactory)
+ * .create();
+ * }
+ * Like {@code GsonBuilder}, this API supports chaining: {@code
+ * RuntimeTypeAdapterFactory shapeAdapterFactory = RuntimeTypeAdapterFactory.of(Shape.class)
+ * .registerSubtype(Rectangle.class)
+ * .registerSubtype(Circle.class)
+ * .registerSubtype(Diamond.class);
+ * }
+ */
+public final class RuntimeTypeAdapterFactory implements TypeAdapterFactory {
+ private final Class> baseType;
+ private final String typeFieldName;
+ private final Map> labelToSubtype = new LinkedHashMap>();
+ private final Map, String> subtypeToLabel = new LinkedHashMap, String>();
+ private final boolean maintainType;
+
+ private RuntimeTypeAdapterFactory(Class> baseType, String typeFieldName, boolean maintainType) {
+ if (typeFieldName == null || baseType == null) {
+ throw new NullPointerException();
+ }
+ this.baseType = baseType;
+ this.typeFieldName = typeFieldName;
+ this.maintainType = maintainType;
+ }
+
+ /**
+ * Creates a new runtime type adapter using for {@code baseType} using {@code
+ * typeFieldName} as the type field name. Type field names are case sensitive.
+ * {@code maintainType} flag decide if the type will be stored in pojo or not.
+ */
+ public static RuntimeTypeAdapterFactory of(Class baseType, String typeFieldName, boolean maintainType) {
+ return new RuntimeTypeAdapterFactory(baseType, typeFieldName, maintainType);
+ }
+
+ /**
+ * Creates a new runtime type adapter using for {@code baseType} using {@code
+ * typeFieldName} as the type field name. Type field names are case sensitive.
+ */
+ public static RuntimeTypeAdapterFactory of(Class baseType, String typeFieldName) {
+ return new RuntimeTypeAdapterFactory(baseType, typeFieldName, false);
+ }
+
+ /**
+ * Creates a new runtime type adapter for {@code baseType} using {@code "type"} as
+ * the type field name.
+ */
+ public static RuntimeTypeAdapterFactory of(Class baseType) {
+ return new RuntimeTypeAdapterFactory(baseType, "type", false);
+ }
+
+ /**
+ * Registers {@code type} identified by {@code label}. Labels are case
+ * sensitive.
+ *
+ * @throws IllegalArgumentException if either {@code type} or {@code label}
+ * have already been registered on this type adapter.
+ */
+ public RuntimeTypeAdapterFactory registerSubtype(Class extends T> type, String label) {
+ if (type == null || label == null) {
+ throw new NullPointerException();
+ }
+ if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) {
+ throw new IllegalArgumentException("types and labels must be unique");
+ }
+ labelToSubtype.put(label, type);
+ subtypeToLabel.put(type, label);
+ return this;
+ }
+
+ /**
+ * Registers {@code type} identified by its {@link Class#getSimpleName simple
+ * name}. Labels are case sensitive.
+ *
+ * @throws IllegalArgumentException if either {@code type} or its simple name
+ * have already been registered on this type adapter.
+ */
+ public RuntimeTypeAdapterFactory registerSubtype(Class extends T> type) {
+ return registerSubtype(type, type.getSimpleName());
+ }
+
+ public TypeAdapter create(Gson gson, TypeToken type) {
+ if (type.getRawType() != baseType) {
+ return null;
+ }
+
+ final Map> labelToDelegate
+ = new LinkedHashMap>();
+ final Map, TypeAdapter>> subtypeToDelegate
+ = new LinkedHashMap, TypeAdapter>>();
+ for (Map.Entry> entry : labelToSubtype.entrySet()) {
+ TypeAdapter> delegate = gson.getDelegateAdapter(this, TypeToken.get(entry.getValue()));
+ labelToDelegate.put(entry.getKey(), delegate);
+ subtypeToDelegate.put(entry.getValue(), delegate);
+ }
+
+ return new TypeAdapter() {
+ @Override public R read(JsonReader in) throws IOException {
+ JsonElement jsonElement = Streams.parse(in);
+ JsonElement labelJsonElement;
+ if (maintainType) {
+ labelJsonElement = jsonElement.getAsJsonObject().get(typeFieldName);
+ } else {
+ labelJsonElement = jsonElement.getAsJsonObject().remove(typeFieldName);
+ }
+
+ if (labelJsonElement == null) {
+ throw new JsonParseException("cannot deserialize " + baseType
+ + " because it does not define a field named " + typeFieldName);
+ }
+ String label = labelJsonElement.getAsString();
+ @SuppressWarnings("unchecked") // registration requires that subtype extends T
+ TypeAdapter delegate = (TypeAdapter) labelToDelegate.get(label);
+ if (delegate == null) {
+ throw new JsonParseException("cannot deserialize " + baseType + " subtype named "
+ + label + "; did you forget to register a subtype?");
+ }
+ return delegate.fromJsonTree(jsonElement);
+ }
+
+ @Override public void write(JsonWriter out, R value) throws IOException {
+ Class> srcType = value.getClass();
+ String label = subtypeToLabel.get(srcType);
+ @SuppressWarnings("unchecked") // registration requires that subtype extends T
+ TypeAdapter delegate = (TypeAdapter) subtypeToDelegate.get(srcType);
+ if (delegate == null) {
+ throw new JsonParseException("cannot serialize " + srcType.getName()
+ + "; did you forget to register a subtype?");
+ }
+ JsonObject jsonObject = delegate.toJsonTree(value).getAsJsonObject();
+
+ if (maintainType) {
+ Streams.write(jsonObject, out);
+ return;
+ }
+
+ JsonObject clone = new JsonObject();
+
+ if (jsonObject.has(typeFieldName)) {
+ throw new JsonParseException("cannot serialize " + srcType.getName()
+ + " because it already defines a field named " + typeFieldName);
+ }
+ clone.add(typeFieldName, new JsonPrimitive(label));
+
+ for (Map.Entry e : jsonObject.entrySet()) {
+ clone.add(e.getKey(), e.getValue());
+ }
+ Streams.write(clone, out);
+ }
+ }.nullSafe();
+ }
+}
diff --git a/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java b/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java
new file mode 100644
index 0000000000..847ec1b85d
--- /dev/null
+++ b/gson/src/test/java/org/baeldung/gson/conversion/JsonObjectConversionsUnitTest.java
@@ -0,0 +1,33 @@
+package org.baeldung.gson.conversion;
+
+import com.google.gson.*;
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+
+public class JsonObjectConversionsUnitTest {
+
+ @Test
+ void whenUsingJsonParser_thenConvertToJsonObject() throws Exception {
+ // Example 1: Using JsonParser
+ String json = "{ \"name\": \"Baeldung\", \"java\": true }";
+
+ JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
+
+ Assert.assertTrue(jsonObject.isJsonObject());
+ Assert.assertTrue(jsonObject.get("name").getAsString().equals("Baeldung"));
+ Assert.assertTrue(jsonObject.get("java").getAsBoolean() == true);
+ }
+
+ @Test
+ void whenUsingGsonInstanceFromJson_thenConvertToJsonObject() throws Exception {
+ // Example 2: Using fromJson
+ String json = "{ \"name\": \"Baeldung\", \"java\": true }";
+
+ JsonObject convertedObject = new Gson().fromJson(json, JsonObject.class);
+
+ Assert.assertTrue(convertedObject.isJsonObject());
+ Assert.assertTrue(convertedObject.get("name").getAsString().equals("Baeldung"));
+ Assert.assertTrue(convertedObject.get("java").getAsBoolean() == true);
+ }
+
+}
diff --git a/guava-modules/pom.xml b/guava-modules/pom.xml
new file mode 100644
index 0000000000..fed9e446f7
--- /dev/null
+++ b/guava-modules/pom.xml
@@ -0,0 +1,22 @@
+
+
+ 4.0.0
+ guava-modules
+ guava-modules
+ pom
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+ ..
+
+
+
+ guava-18
+ guava-19
+ guava-21
+
+
+
diff --git a/guava/README.md b/guava/README.md
index 0346d34903..60754dbe57 100644
--- a/guava/README.md
+++ b/guava/README.md
@@ -18,4 +18,3 @@
- [Hamcrest Text Matchers](http://www.baeldung.com/hamcrest-text-matchers)
- [Quick Guide to the Guava RateLimiter](http://www.baeldung.com/guava-rate-limiter)
- [Hamcrest File Matchers](https://www.baeldung.com/hamcrest-file-matchers)
-- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java)
diff --git a/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java b/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerUnitTest.java
similarity index 97%
rename from guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java
rename to guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerUnitTest.java
index 2711a77ebd..9808546e82 100644
--- a/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerTest.java
+++ b/guest/spring-boot-app/src/test/java/com/stackify/test/EmployeeControllerUnitTest.java
@@ -21,7 +21,7 @@ import com.stackify.Application;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@WebAppConfiguration
-public class EmployeeControllerTest {
+public class EmployeeControllerUnitTest {
private static final String CONTENT_TYPE = "application/json;charset=UTF-8";
diff --git a/guice/README.md b/guice/README.md
index d1bd1ff883..77c788c363 100644
--- a/guice/README.md
+++ b/guice/README.md
@@ -2,3 +2,4 @@
### Relevant Articles
- [Guide to Google Guice](http://www.baeldung.com/guice)
+- [Guice vs Spring – Dependency Injection](https://www.baeldung.com/guice-spring-dependency-injection)
diff --git a/guice/pom.xml b/guice/pom.xml
index f3e7873245..8ed2b557dc 100644
--- a/guice/pom.xml
+++ b/guice/pom.xml
@@ -5,8 +5,8 @@
com.baeldung.examples.guice
guice
1.0-SNAPSHOT
- jar
guice
+ jar
com.baeldung
@@ -26,4 +26,4 @@
4.1.0
-
+
\ No newline at end of file
diff --git a/guice/src/main/java/com/baeldung/examples/common/Account.java b/guice/src/main/java/com/baeldung/examples/common/Account.java
new file mode 100644
index 0000000000..fd2df005ac
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/Account.java
@@ -0,0 +1,24 @@
+package com.baeldung.examples.common;
+
+public class Account {
+
+ private String accountNumber;
+ private String type;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/AccountService.java b/guice/src/main/java/com/baeldung/examples/common/AccountService.java
new file mode 100644
index 0000000000..97a64e3c6e
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/AccountService.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public interface AccountService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java
new file mode 100644
index 0000000000..18d6777c4a
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public class AccountServiceImpl implements AccountService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/AudioBookService.java b/guice/src/main/java/com/baeldung/examples/common/AudioBookService.java
new file mode 100644
index 0000000000..5d501f2051
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/AudioBookService.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public interface AudioBookService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/AudioBookServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/AudioBookServiceImpl.java
new file mode 100644
index 0000000000..c64e953a58
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/AudioBookServiceImpl.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public class AudioBookServiceImpl implements AudioBookService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/AuthorService.java b/guice/src/main/java/com/baeldung/examples/common/AuthorService.java
new file mode 100644
index 0000000000..9be148b8c3
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/AuthorService.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public interface AuthorService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/AuthorServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/AuthorServiceImpl.java
new file mode 100644
index 0000000000..bac532e469
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/AuthorServiceImpl.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public class AuthorServiceImpl implements AuthorService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/BookService.java b/guice/src/main/java/com/baeldung/examples/common/BookService.java
new file mode 100644
index 0000000000..56339c1398
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/BookService.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public interface BookService {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java b/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java
new file mode 100644
index 0000000000..aee0d22e51
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java
@@ -0,0 +1,7 @@
+package com.baeldung.examples.common;
+
+public class BookServiceImpl implements BookService {
+
+ private AuthorService authorService;
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/PersonDao.java b/guice/src/main/java/com/baeldung/examples/common/PersonDao.java
new file mode 100644
index 0000000000..980fee0252
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/PersonDao.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public interface PersonDao {
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java
new file mode 100644
index 0000000000..ecbf198cc0
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java
@@ -0,0 +1,5 @@
+package com.baeldung.examples.common;
+
+public class PersonDaoImpl implements PersonDao {
+
+}
\ No newline at end of file
diff --git a/guice/src/main/java/com/baeldung/examples/guice/Foo.java b/guice/src/main/java/com/baeldung/examples/guice/Foo.java
new file mode 100644
index 0000000000..fca32b165b
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/guice/Foo.java
@@ -0,0 +1,4 @@
+package com.baeldung.examples.guice;
+
+public class Foo {
+}
diff --git a/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java b/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java
new file mode 100644
index 0000000000..929013cd2b
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java
@@ -0,0 +1,9 @@
+package com.baeldung.examples.guice;
+
+import com.google.inject.Inject;
+
+public class FooProcessor {
+
+ @Inject
+ private Foo foo;
+}
\ No newline at end of file
diff --git a/guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java b/guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java
new file mode 100644
index 0000000000..ce12e3e528
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/guice/GuicePersonService.java
@@ -0,0 +1,19 @@
+package com.baeldung.examples.guice;
+
+import com.baeldung.examples.common.PersonDao;
+import com.google.inject.Inject;
+
+public class GuicePersonService {
+
+ @Inject
+ private PersonDao personDao;
+
+ public PersonDao getPersonDao() {
+ return personDao;
+ }
+
+ public void setPersonDao(PersonDao personDao) {
+ this.personDao = personDao;
+ }
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java b/guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java
new file mode 100644
index 0000000000..0e58d0bacf
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/guice/GuiceUserService.java
@@ -0,0 +1,19 @@
+package com.baeldung.examples.guice;
+
+import com.baeldung.examples.common.AccountService;
+import com.google.inject.Inject;
+
+public class GuiceUserService {
+
+ @Inject
+ private AccountService accountService;
+
+ public AccountService getAccountService() {
+ return accountService;
+ }
+
+ public void setAccountService(AccountService accountService) {
+ this.accountService = accountService;
+ }
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/guice/Person.java b/guice/src/main/java/com/baeldung/examples/guice/Person.java
new file mode 100644
index 0000000000..d54b5110eb
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/guice/Person.java
@@ -0,0 +1,24 @@
+package com.baeldung.examples.guice;
+
+public class Person {
+ private String firstName;
+
+ private String lastName;
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+}
diff --git a/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java b/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java
new file mode 100644
index 0000000000..fbcd36b56a
--- /dev/null
+++ b/guice/src/main/java/com/baeldung/examples/guice/modules/GuiceModule.java
@@ -0,0 +1,50 @@
+package com.baeldung.examples.guice.modules;
+
+import com.baeldung.examples.common.AccountService;
+import com.baeldung.examples.common.AccountServiceImpl;
+import com.baeldung.examples.common.BookService;
+import com.baeldung.examples.common.BookServiceImpl;
+import com.baeldung.examples.common.PersonDao;
+import com.baeldung.examples.common.PersonDaoImpl;
+import com.baeldung.examples.guice.Foo;
+import com.baeldung.examples.guice.Person;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provider;
+import com.google.inject.Provides;
+
+public class GuiceModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ try {
+ bind(AccountService.class).to(AccountServiceImpl.class);
+ bind(Person.class).toConstructor(Person.class.getConstructor());
+ // bind(Person.class).toProvider(new Provider() {
+ // public Person get() {
+ // Person p = new Person();
+ // return p;
+ // }
+ // });
+ bind(Foo.class).toProvider(new Provider() {
+ public Foo get() {
+ return new Foo();
+ }
+ });
+ bind(PersonDao.class).to(PersonDaoImpl.class);
+
+ } catch (NoSuchMethodException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ @Provides
+ public BookService bookServiceGenerator() {
+ return new BookServiceImpl();
+ }
+
+}
diff --git a/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java b/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java
new file mode 100644
index 0000000000..dd2a89e101
--- /dev/null
+++ b/guice/src/test/java/com/baeldung/examples/GuiceUnitTest.java
@@ -0,0 +1,61 @@
+package com.baeldung.examples;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+import com.baeldung.examples.common.BookService;
+import com.baeldung.examples.guice.FooProcessor;
+import com.baeldung.examples.guice.GuicePersonService;
+import com.baeldung.examples.guice.GuiceUserService;
+import com.baeldung.examples.guice.Person;
+import com.baeldung.examples.guice.modules.GuiceModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class GuiceUnitTest {
+
+ @Test
+ public void givenAccountServiceInjectedInGuiceUserService_WhenGetAccountServiceInvoked_ThenReturnValueIsNotNull() {
+ Injector injector = Guice.createInjector(new GuiceModule());
+ GuiceUserService guiceUserService = injector.getInstance(GuiceUserService.class);
+ assertNotNull(guiceUserService.getAccountService());
+ }
+
+ @Test
+ public void givenBookServiceIsRegisteredInModule_WhenBookServiceIsInjected_ThenReturnValueIsNotNull() {
+ Injector injector = Guice.createInjector(new GuiceModule());
+ BookService bookService = injector.getInstance(BookService.class);
+ assertNotNull(bookService);
+ }
+
+ @Test
+ public void givenMultipleBindingsForPerson_WhenPersonIsInjected_ThenTestFailsByProvisionException() {
+ Injector injector = Guice.createInjector(new GuiceModule());
+ Person person = injector.getInstance(Person.class);
+ assertNotNull(person);
+ }
+
+ @Test
+ public void givenFooInjectedToFooProcessorAsOptionalDependency_WhenFooProcessorIsRetrievedFromContext_ThenCreationExceptionIsNotThrown() {
+ Injector injector = Guice.createInjector(new GuiceModule());
+ FooProcessor fooProcessor = injector.getInstance(FooProcessor.class);
+ assertNotNull(fooProcessor);
+ }
+
+ @Test
+ public void givenGuicePersonServiceConstructorAnnotatedByInject_WhenGuicePersonServiceIsInjected_ThenInstanceWillBeCreatedFromTheConstructor() {
+ Injector injector = Guice.createInjector(new GuiceModule());
+ GuicePersonService personService = injector.getInstance(GuicePersonService.class);
+ assertNotNull(personService);
+ }
+
+ @Test
+ public void givenPersonDaoInjectedToGuicePersonServiceBySetterInjection_WhenGuicePersonServiceIsInjected_ThenPersonDaoInitializedByTheSetter() {
+ Injector injector = Guice.createInjector(new GuiceModule());
+ GuicePersonService personService = injector.getInstance(GuicePersonService.class);
+ assertNotNull(personService);
+ assertNotNull(personService.getPersonDao());
+ }
+
+}
diff --git a/httpclient/README.md b/httpclient/README.md
index 93e0f3c9e1..7c5122c5b8 100644
--- a/httpclient/README.md
+++ b/httpclient/README.md
@@ -14,11 +14,11 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Unshorten URLs with HttpClient](http://www.baeldung.com/unshorten-url-httpclient)
- [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl)
- [HttpClient 4 – Follow Redirects for POST](http://www.baeldung.com/httpclient-redirect-on-http-post)
-- [HttpClient – Set Custom Header](http://www.baeldung.com/httpclient-custom-http-header)
+- [Custom HTTP Header with the HttpClient](http://www.baeldung.com/httpclient-custom-http-header)
- [HttpClient Basic Authentication](http://www.baeldung.com/httpclient-4-basic-authentication)
- [Multipart Upload with HttpClient 4](http://www.baeldung.com/httpclient-multipart-upload)
- [HttpAsyncClient Tutorial](http://www.baeldung.com/httpasyncclient-tutorial)
- [HttpClient 4 Tutorial](http://www.baeldung.com/httpclient-guide)
- [Advanced HttpClient Configuration](http://www.baeldung.com/httpclient-advanced-config)
- [HttpClient 4 – Do Not Follow Redirects](http://www.baeldung.com/httpclient-stop-follow-redirect)
-- [HttpClient 4 – Setting a Custom User-Agent](http://www.baeldung.com/httpclient-user-agent-header)
+- [Custom User-Agent in HttpClient 4](http://www.baeldung.com/httpclient-user-agent-header)
diff --git a/jackson/README.md b/jackson/README.md
index 04e88d0ea1..25194c7255 100644
--- a/jackson/README.md
+++ b/jackson/README.md
@@ -10,14 +10,14 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Jackson – Unmarshall to Collection/Array](http://www.baeldung.com/jackson-collection-array)
- [Jackson Unmarshalling json with Unknown Properties](http://www.baeldung.com/jackson-deserialize-json-unknown-properties)
- [Jackson – Custom Serializer](http://www.baeldung.com/jackson-custom-serialization)
-- [Jackson – Custom Deserializer](http://www.baeldung.com/jackson-deserialization)
+- [Getting Started with Custom Deserialization in Jackson](http://www.baeldung.com/jackson-deserialization)
- [Jackson Exceptions – Problems and Solutions](http://www.baeldung.com/jackson-exception)
- [Jackson Date](http://www.baeldung.com/jackson-serialize-dates)
- [Jackson – Bidirectional Relationships](http://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion)
- [Jackson JSON Tutorial](http://www.baeldung.com/jackson)
- [Jackson – Working with Maps and nulls](http://www.baeldung.com/jackson-map-null-values-or-null-key)
- [Jackson – Decide What Fields Get Serialized/Deserializaed](http://www.baeldung.com/jackson-field-serializable-deserializable-or-not)
-- [A Guide to Jackson Annotations](http://www.baeldung.com/jackson-annotations)
+- [Jackson Annotation Examples](http://www.baeldung.com/jackson-annotations)
- [Working with Tree Model Nodes in Jackson](http://www.baeldung.com/jackson-json-node-tree-model)
- [Jackson vs Gson](http://www.baeldung.com/jackson-vs-gson)
- [Intro to the Jackson ObjectMapper](http://www.baeldung.com/jackson-object-mapper-tutorial)
@@ -25,7 +25,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [More Jackson Annotations](http://www.baeldung.com/jackson-advanced-annotations)
- [Inheritance with Jackson](http://www.baeldung.com/jackson-inheritance)
- [Guide to @JsonFormat in Jackson](http://www.baeldung.com/jackson-jsonformat)
-- [A Guide to Optional with Jackson](http://www.baeldung.com/jackson-optional)
+- [Using Optional with Jackson](http://www.baeldung.com/jackson-optional)
- [Map Serialization and Deserialization with Jackson](http://www.baeldung.com/jackson-map)
- [Jackson Streaming API](http://www.baeldung.com/jackson-streaming-api)
- [Jackson – JsonMappingException (No serializer found for class)](http://www.baeldung.com/jackson-jsonmappingexception)
@@ -37,3 +37,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Serialize Only Fields that meet a Custom Criteria with Jackson](http://www.baeldung.com/jackson-serialize-field-custom-criteria)
- [Mapping Nested Values with Jackson](http://www.baeldung.com/jackson-nested-values)
- [Convert XML to JSON Using Jackson](https://www.baeldung.com/jackson-convert-xml-json)
+- [Deserialize Immutable Objects with Jackson](https://www.baeldung.com/jackson-deserialize-immutable-objects)
diff --git a/jackson/pom.xml b/jackson/pom.xml
index e941ababc5..948248d255 100644
--- a/jackson/pom.xml
+++ b/jackson/pom.xml
@@ -117,8 +117,6 @@
-
- 2.9.7
3.8
2.10
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java
new file mode 100644
index 0000000000..44b10ee39b
--- /dev/null
+++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Employee.java
@@ -0,0 +1,24 @@
+package com.baeldung.jackson.deserialization.immutable;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Employee {
+
+ private final long id;
+ private final String name;
+
+ @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
+ public Employee(@JsonProperty("id") long id, @JsonProperty("name") String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java
new file mode 100644
index 0000000000..d9041720b6
--- /dev/null
+++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/immutable/Person.java
@@ -0,0 +1,44 @@
+package com.baeldung.jackson.deserialization.immutable;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
+
+@JsonDeserialize(builder = Person.Builder.class)
+public class Person {
+
+ private final String name;
+ private final Integer age;
+
+ private Person(String name, Integer age) {
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ @JsonPOJOBuilder
+ static class Builder {
+ String name;
+ Integer age;
+
+ Builder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ Builder withAge(Integer age) {
+ this.age = age;
+ return this;
+ }
+
+ Person build() {
+ return new Person(name, age);
+ }
+ }
+}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java
deleted file mode 100644
index db8b594509..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jacksoninject/Author.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.baeldung.jackson.deserialization.jacksoninject;
-
-import com.baeldung.jackson.domain.Item;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Author extends Person {
-
- List- items = new ArrayList<>();
-
- public Author() {
- }
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java
index c4daf68bd6..d9748e2997 100644
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java
+++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonanysetter/Inventory.java
@@ -1,24 +1,14 @@
package com.baeldung.jackson.deserialization.jsonanysetter;
-import com.baeldung.jackson.domain.Author;
-import com.baeldung.jackson.domain.Item;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
import java.util.HashMap;
import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+
public class Inventory {
- private Map stock = new HashMap<>();
-
private Map countryDeliveryCost = new HashMap<>();
- @JsonIgnore
- public Map getStock() {
- return stock;
- }
-
public Map getCountryDeliveryCost() {
return countryDeliveryCost;
}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java
deleted file mode 100644
index d48c95b255..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsoncreator/Author.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.baeldung.jackson.deserialization.jsoncreator;
-
-import com.baeldung.jackson.domain.Person;
-import com.baeldung.jackson.domain.Item;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Author extends Person {
-
- List
- items = new ArrayList<>();
-
- @JsonCreator
- public Author(@JsonProperty("christianName") String firstName, @JsonProperty("surname") String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Author.java
deleted file mode 100644
index 62e108facb..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Author.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.baeldung.jackson.deserialization.jsondeserialize;
-
-import com.baeldung.jackson.domain.Item;
-import com.baeldung.jackson.domain.Person;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Author extends Person {
-
- List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java
index dc0d0ee623..1e411da64e 100644
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java
+++ b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Book.java
@@ -1,12 +1,16 @@
package com.baeldung.jackson.deserialization.jsondeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
import java.math.BigDecimal;
import java.util.Date;
+import java.util.UUID;
-public class Book extends Item {
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+public class Book {
+
+ private UUID id;
+ private String title;
+ private float price;
private String ISBN;
@JsonDeserialize(using = CustomDateDeserializer.class)
@@ -16,8 +20,9 @@ public class Book extends Item {
public Book() {
}
- public Book(String title, Author author) {
- super(title, author);
+ public Book(String title) {
+ this.id = UUID.randomUUID();
+ this.title = title;
}
public String getISBN() {
@@ -43,4 +48,28 @@ public class Book extends Item {
public void setPages(BigDecimal pages) {
this.pages = pages;
}
+
+ public UUID getId() {
+ return id;
+ }
+
+ public void setId(UUID id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public float getPrice() {
+ return price;
+ }
+
+ public void setPrice(float price) {
+ this.price = price;
+ }
}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java
deleted file mode 100644
index fc27a586ac..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsondeserialize/Item.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.baeldung.jackson.deserialization.jsondeserialize;
-
-import com.baeldung.jackson.domain.Person;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Item {
-
- private UUID id;
- private String title;
- private List authors = new ArrayList<>();
- private float price;
-
- public Item() {
- }
-
- public Item(String title, Author author) {
- this.id = UUID.randomUUID();
- this.title = title;
- this.authors.add(author);
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public List getAuthors() {
- return authors;
- }
-
- public void setAuthors(List authors) {
- this.authors = authors;
- }
-
- public float getPrice() {
- return price;
- }
-
- public void setPrice(float price) {
- this.price = price;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java b/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java
deleted file mode 100644
index 3f9ae70a88..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/deserialization/jsonsetter/Author.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.baeldung.jackson.deserialization.jsonsetter;
-
-import com.baeldung.jackson.domain.Item;
-import com.baeldung.jackson.domain.Person;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonSetter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Author extends Person {
-
- private List
- items = new ArrayList<>();
-
- public Author() {
- }
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- @JsonIgnore
- public List
- getItems() {
- return items;
- }
-
- @JsonSetter("publications")
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Author.java b/jackson/src/main/java/com/baeldung/jackson/domain/Author.java
deleted file mode 100644
index 9000c00f21..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Author.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.baeldung.jackson.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Author extends Person {
-
- private List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Book.java b/jackson/src/main/java/com/baeldung/jackson/domain/Book.java
deleted file mode 100644
index a5963e33ba..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Book.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.baeldung.jackson.domain;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Book extends Item {
-
- private String ISBN;
- private Date published;
- private BigDecimal pages;
-
- public Book() {
- }
-
- public Book(String title, Author author) {
- super(title, author);
- }
-
- public String getISBN() {
- return ISBN;
- }
-
- public void setISBN(String ISBN) {
- this.ISBN = ISBN;
- }
-
- public Date getPublished() {
- return published;
- }
-
- public void setPublished(Date published) {
- this.published = published;
- }
-
- public BigDecimal getPages() {
- return pages;
- }
-
- public void setPages(BigDecimal pages) {
- this.pages = pages;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Course.java b/jackson/src/main/java/com/baeldung/jackson/domain/Course.java
deleted file mode 100644
index 672b0bc250..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Course.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.baeldung.jackson.domain;
-
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Course extends Item {
-
- public enum Medium {
- CLASSROOM, ONLINE
- }
-
- public enum Level {
- BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3);
-
- private String name;
- private int number;
-
- Level(String name, int number) {
- this.name = name;
- this.number = number;
- }
-
- public String getName() {
- return name;
- }
- }
-
- private float duration;
- private Medium medium;
- private Level level;
- private List prerequisite;
-
- public Course(String title, Author author) {
- super(title, author);
- }
-
- public float getDuration() {
- return duration;
- }
-
- public void setDuration(float duration) {
- this.duration = duration;
- }
-
- public Medium getMedium() {
- return medium;
- }
-
- public void setMedium(Medium medium) {
- this.medium = medium;
- }
-
- public Level getLevel() {
- return level;
- }
-
- public void setLevel(Level level) {
- this.level = level;
- }
-
- public List getPrerequisite() {
- return prerequisite;
- }
-
- public void setPrerequisite(List prerequisite) {
- this.prerequisite = prerequisite;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Customer.java b/jackson/src/main/java/com/baeldung/jackson/domain/Customer.java
deleted file mode 100644
index 1e03ff9a13..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Customer.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.baeldung.jackson.domain;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Customer extends Person {
-
- private String configuration;
-
- public Customer(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public String getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(String configuration) {
- this.configuration = configuration;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Inventory.java b/jackson/src/main/java/com/baeldung/jackson/domain/Inventory.java
deleted file mode 100644
index 41b7dc51da..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Inventory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.baeldung.jackson.domain;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Inventory {
-
- private Map stock;
-
- private Map countryDeliveryCost = new HashMap<>();
-
- public Map getStock() {
- return stock;
- }
-
- public void setStock(Map stock) {
- this.stock = stock;
- }
-
- public Map getCountryDeliveryCost() {
- return countryDeliveryCost;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Item.java b/jackson/src/main/java/com/baeldung/jackson/domain/Item.java
deleted file mode 100644
index d9d1350a8e..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Item.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.baeldung.jackson.domain;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Item {
-
- private UUID id;
- private String title;
- private List authors = new ArrayList<>();
- private float price;
-
- public Item() {
- }
-
- public Item(String title, Author author) {
- this.id = UUID.randomUUID();
- this.title = title;
- this.authors.add(author);
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public List getAuthors() {
- return authors;
- }
-
- public void setAuthors(List authors) {
- this.authors = authors;
- }
-
- public float getPrice() {
- return price;
- }
-
- public void setPrice(float price) {
- this.price = price;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Order.java b/jackson/src/main/java/com/baeldung/jackson/domain/Order.java
deleted file mode 100644
index 91f87f74df..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Order.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.baeldung.jackson.domain;
-
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Order {
-
- private UUID id;
- private Type type;
- private int internalAudit;
-
- public static class Type {
- public long id;
- public String name;
- }
-
- public Order() {
- this.id = UUID.randomUUID();
- }
-
- public Order(Type type) {
- this();
- this.type = type;
- }
-
- public Order(int internalAudit) {
- this();
- this.type = new Type();
- this.type.id = 20;
- this.type.name = "Order";
- this.internalAudit = internalAudit;
- }
-
- public UUID getId() {
- return id;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/domain/Person.java b/jackson/src/main/java/com/baeldung/jackson/domain/Person.java
index 785efff755..f11ba41113 100644
--- a/jackson/src/main/java/com/baeldung/jackson/domain/Person.java
+++ b/jackson/src/main/java/com/baeldung/jackson/domain/Person.java
@@ -1,24 +1,12 @@
package com.baeldung.jackson.domain;
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
public class Person {
- private UUID id;
private String firstName;
private String lastName;
-
- public Person() {
- }
-
+
public Person(String firstName, String lastName) {
- this.id = UUID.randomUUID();
+ super();
this.firstName = firstName;
this.lastName = lastName;
}
@@ -38,8 +26,5 @@ public class Person {
public void setLastName(String lastName) {
this.lastName = lastName;
}
-
- public UUID getId() {
- return id;
- }
}
+
diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonautodetect/Order.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonautodetect/Order.java
deleted file mode 100644
index f2ff5eeb08..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonautodetect/Order.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.baeldung.jackson.inclusion.jsonautodetect;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@JsonAutoDetect(fieldVisibility = Visibility.ANY)
-public class Order {
-
- private UUID id;
- private Type type;
- private int internalAudit;
-
- public static class Type {
- public long id;
- public String name;
- }
-
- public Order() {
- this.id = UUID.randomUUID();
- }
-
- public Order(Type type) {
- this();
- this.type = type;
- }
-
- public Order(int internalAudit) {
- this();
- this.type = new Type();
- this.type.id = 20;
- this.type.name = "Order";
- this.internalAudit = internalAudit;
- }
-
- public UUID getId() {
- return id;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Author.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Author.java
deleted file mode 100644
index a7801493bf..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Author.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.baeldung.jackson.inclusion.jsonignore;
-
-import com.baeldung.jackson.domain.Item;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Author extends Person {
-
- private List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java
deleted file mode 100644
index 0037d83148..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignore/Person.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.baeldung.jackson.inclusion.jsonignore;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Person {
-
- @JsonIgnore
- private UUID id;
- private String firstName;
- private String lastName;
-
- public Person() {
- }
-
- public Person(String firstName, String lastName) {
- this.id = UUID.randomUUID();
- this.firstName = firstName;
- this.lastName = lastName;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public UUID getId() {
- return id;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java
deleted file mode 100644
index 70b4dd9842..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoreproperties/Course.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.baeldung.jackson.inclusion.jsonignoreproperties;
-
-import com.baeldung.jackson.domain.Author;
-import com.baeldung.jackson.domain.Item;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@JsonIgnoreProperties({ "medium" })
-public class Course extends Item {
-
- public enum Medium {
- CLASSROOM, ONLINE
- }
-
- public enum Level {
- BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3);
-
- private String name;
- private int number;
-
- Level(String name, int number) {
- this.name = name;
- this.number = number;
- }
-
- public String getName() {
- return name;
- }
- }
-
- private float duration;
- private Medium medium;
- private Level level;
- private List prerequisite;
-
- public Course(String title, Author author) {
- super(title, author);
- }
-
- public float getDuration() {
- return duration;
- }
-
- public void setDuration(float duration) {
- this.duration = duration;
- }
-
- public Medium getMedium() {
- return medium;
- }
-
- public void setMedium(Medium medium) {
- this.medium = medium;
- }
-
- public Level getLevel() {
- return level;
- }
-
- public void setLevel(Level level) {
- this.level = level;
- }
-
- public List getPrerequisite() {
- return prerequisite;
- }
-
- public void setPrerequisite(List prerequisite) {
- this.prerequisite = prerequisite;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoretype/Order.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoretype/Order.java
deleted file mode 100644
index 0d8867933f..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsonignoretype/Order.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.baeldung.jackson.inclusion.jsonignoretype;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreType;
-
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Order {
-
- private UUID id;
- private Type type;
-
- @JsonIgnoreType
- public static class Type {
- public long id;
- public String name;
- }
-
- public Order() {
- this.id = UUID.randomUUID();
- }
-
- public Order(Type type) {
- this();
- this.type = type;
- }
-
- public UUID getId() {
- return id;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsoninclude/Author.java b/jackson/src/main/java/com/baeldung/jackson/inclusion/jsoninclude/Author.java
deleted file mode 100644
index 30cb2735c2..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/inclusion/jsoninclude/Author.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.baeldung.jackson.inclusion.jsoninclude;
-
-import com.baeldung.jackson.domain.Person;
-import com.baeldung.jackson.domain.Item;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@JsonInclude(NON_NULL)
-public class Author extends Person {
-
- private List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java
deleted file mode 100644
index a44492b9f7..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Course.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.baeldung.jackson.miscellaneous.custom;
-
-import com.baeldung.jackson.domain.Author;
-
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@CustomCourseAnnotation
-public class Course extends Item {
-
- public enum Medium {
- CLASSROOM, ONLINE
- }
-
- public enum Level {
- BEGINNER("Beginner", 1), INTERMEDIATE("Intermediate", 2), ADVANCED("Advanced", 3);
-
- private String name;
- private int number;
-
- Level(String name, int number) {
- this.name = name;
- this.number = number;
- }
-
- public String getName() {
- return name;
- }
- }
-
- private float duration;
- private Medium medium;
- private Level level;
- private List prerequisite;
-
- public Course(String title, Author author) {
- super(title, author);
- }
-
- public float getDuration() {
- return duration;
- }
-
- public void setDuration(float duration) {
- this.duration = duration;
- }
-
- public Medium getMedium() {
- return medium;
- }
-
- public void setMedium(Medium medium) {
- this.medium = medium;
- }
-
- public Level getLevel() {
- return level;
- }
-
- public void setLevel(Level level) {
- this.level = level;
- }
-
- public List getPrerequisite() {
- return prerequisite;
- }
-
- public void setPrerequisite(List prerequisite) {
- this.prerequisite = prerequisite;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java
deleted file mode 100644
index d7f72ca6ec..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/CustomCourseAnnotation.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.baeldung.jackson.miscellaneous.custom;
-
-import com.fasterxml.jackson.annotation.*;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@Retention(RetentionPolicy.RUNTIME)
-@JacksonAnnotationsInside
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "title", "price", "id", "duration", "authors", "level" })
-@JsonIgnoreProperties({ "prerequisite" })
-public @interface CustomCourseAnnotation {
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java
deleted file mode 100644
index 6625283dec..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/custom/Item.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.baeldung.jackson.miscellaneous.custom;
-
-import com.baeldung.jackson.domain.Author;
-import com.baeldung.jackson.domain.Person;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Item {
-
- private UUID id;
- private String title;
- private List authors = new ArrayList<>();
- private float price;
-
- public Item() {
- }
-
- public Item(String title, Author author) {
- this.id = UUID.randomUUID();
- this.title = title;
- this.authors.add(author);
- }
-
- public UUID getId() {
- return id;
- }
-
- public void setId(UUID id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public List getAuthors() {
- return authors;
- }
-
- public void setAuthors(List authors) {
- this.authors = authors;
- }
-
- public float getPrice() {
- return price;
- }
-
- public void setPrice(float price) {
- this.price = price;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java
deleted file mode 100644
index 0638e32925..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/disable/Author.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.baeldung.jackson.miscellaneous.disable;
-
-import com.baeldung.jackson.domain.Item;
-import com.baeldung.jackson.domain.Person;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "lastName", "items", "firstName", "id" })
-public class Author extends Person {
-
- @JsonIgnore
- private List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/Author.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/Author.java
deleted file mode 100644
index 26e3e4b647..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/Author.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.baeldung.jackson.miscellaneous.mixin;
-
-import com.baeldung.jackson.domain.Item;
-import com.baeldung.jackson.domain.Person;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Author extends Person {
-
- private List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/IgnoreListMixIn.java b/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/IgnoreListMixIn.java
deleted file mode 100644
index 418c09c251..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/miscellaneous/mixin/IgnoreListMixIn.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.baeldung.jackson.miscellaneous.mixin;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreType;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@JsonIgnoreType
-public class IgnoreListMixIn {
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java b/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java
deleted file mode 100644
index 1813148b2b..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/polymorphism/Order.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.baeldung.jackson.polymorphism;
-
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-
-import java.util.UUID;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Order {
-
- private UUID id;
- private Type type;
- private int internalAudit;
-
- @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ordertype")
- @JsonSubTypes({ @JsonSubTypes.Type(value = InternalType.class, name = "internal") })
- public static class Type {
- public long id;
- public String name;
- }
-
- @JsonTypeName("internal")
- public static class InternalType extends Type {
- public long id;
- public String name;
- }
-
- public Order() {
- this.id = UUID.randomUUID();
- }
-
- public Order(Type type) {
- this();
- this.type = type;
- }
-
- public Order(int internalAudit) {
- this();
- this.type = new Type();
- this.type.id = 20;
- this.type.name = "Order";
- this.internalAudit = internalAudit;
- }
-
- public UUID getId() {
- return id;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonanygetter/Inventory.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonanygetter/Inventory.java
deleted file mode 100644
index 52f586d93b..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonanygetter/Inventory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.baeldung.jackson.serialization.jsonanygetter;
-
-import com.baeldung.jackson.domain.Author;
-import com.baeldung.jackson.domain.Item;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Inventory {
-
- private String location;
-
- private Map stock = new HashMap<>();
-
- private Map countryDeliveryCost = new HashMap<>();
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- @JsonIgnore
- public Map getStock() {
- return stock;
- }
-
- @JsonAnyGetter
- public Map getCountryDeliveryCost() {
- return countryDeliveryCost;
- }
-
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java
deleted file mode 100644
index 8d89fefce7..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsongetter/Author.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.baeldung.jackson.serialization.jsongetter;
-
-import com.baeldung.jackson.domain.Item;
-import com.baeldung.jackson.domain.Person;
-import com.fasterxml.jackson.annotation.JsonGetter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-public class Author extends Person {
-
- List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- @JsonGetter("publications")
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List
- items) {
- this.items = items;
- }
-}
diff --git a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java b/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java
deleted file mode 100644
index dadf893cf9..0000000000
--- a/jackson/src/main/java/com/baeldung/jackson/serialization/jsonpropertyorder/Author.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.baeldung.jackson.serialization.jsonpropertyorder;
-
-import com.baeldung.jackson.domain.Item;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Source code github.com/readlearncode
- *
- * @author Alex Theedom www.readlearncode.com
- * @version 1.0
- */
-@JsonPropertyOrder({ "items", "firstName", "lastName", "id" })
-public class Author extends Person {
-
- List
- items = new ArrayList<>();
-
- public Author(String firstName, String lastName) {
- super(firstName, lastName);
- }
-
- public List
- getItems() {
- return items;
- }
-
- public void setItems(List