* Make default constructors call other constructors with default values
* Fix formatting
* Update year in license headers
This commit is contained in:
Mahmoud Ben Hassine
2021-02-23 15:56:51 +01:00
parent af14a2e471
commit 7b2d7d1993
4 changed files with 13 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,14 +28,14 @@ import com.google.gson.Gson;
*/
public class GsonJsonObjectMarshaller<T> implements JsonObjectMarshaller<T> {
private Gson gson = new Gson();
private Gson gson;
public GsonJsonObjectMarshaller() {
this.gson=new Gson();
this(new Gson());
}
public GsonJsonObjectMarshaller(Gson gson) {
this.gson=gson;
this.gson = gson;
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,8 +55,7 @@ public class GsonJsonObjectReader<T> implements JsonObjectReader<T> {
* @param itemType the target item type
*/
public GsonJsonObjectReader(Class<? extends T> itemType) {
this.mapper = new Gson();
this.itemType = itemType;
this(new Gson(), itemType);
}
public GsonJsonObjectReader(Gson mapper, Class<? extends T> itemType) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,11 +34,11 @@ public class JacksonJsonObjectMarshaller<T> implements JsonObjectMarshaller<T> {
private ObjectMapper objectMapper;
public JacksonJsonObjectMarshaller() {
this.objectMapper = new ObjectMapper();
this(new ObjectMapper());
}
public JacksonJsonObjectMarshaller(ObjectMapper objectMapper) {
this.objectMapper=objectMapper;
this.objectMapper = objectMapper;
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,13 +52,12 @@ public class JacksonJsonObjectReader<T> implements JsonObjectReader<T> {
* @param itemType the target item type
*/
public JacksonJsonObjectReader(Class<? extends T> itemType) {
this.mapper=new ObjectMapper();
this.itemType = itemType;
this(new ObjectMapper(), itemType);
}
public JacksonJsonObjectReader(ObjectMapper mapper, Class<? extends T> itemType) {
this.mapper= mapper;
this.itemType=itemType;
this.mapper = mapper;
this.itemType = itemType;
}
/**