Skip to content

Commit

Permalink
Some code style cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-schnell committed Feb 5, 2024
1 parent 9c1ead8 commit 480439e
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/fuin/objects4j/core/KeyValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static String replace(final String message, final KeyValue... keyValue) {
if (keyValue == null) {
return message;
}
final Map<String, String> map = new HashMap<String, String>();
final Map<String, String> map = new HashMap<>();
for (final KeyValue kv : keyValue) {
if (kv.getValue() instanceof Collection<?> coll) {
final StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import jakarta.validation.constraints.NotNull;
import org.fuin.objects4j.common.Contract;
import org.fuin.objects4j.core.AsStringCapable;
import org.fuin.objects4j.core.ValueOfCapable;

Expand All @@ -34,17 +33,13 @@
*/
public abstract class ValueObjectStringJacksonSerializer<TYPE extends AsStringCapable> extends StdSerializer<TYPE> {

private final ValueOfCapable<TYPE> vop;

/**
* Constructor with mandatory data.
*
* @param vop Provides a valueOf method.
*/
public ValueObjectStringJacksonSerializer(@NotNull final Class<TYPE> clasz, @NotNull final ValueOfCapable<TYPE> vop) {
super(clasz);
Contract.requireArgNotNull("vop", vop);
this.vop = vop;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Test for the {@link Objects4JJacksonAdapterModule} class.
*/
@SuppressWarnings("java:S2187")
class Objects4JJacksonAdapterModuleTest {

// Nothing to test yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Test for the {@link JaxbUtils} class.
*/
@SuppressWarnings("java:S2187")
class JaxbUtilsTest {

// Nothing to test yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Test for the {@link JsonbUtils} class.
*/
@SuppressWarnings("java:S2187")
class JsonbUtilsTest {

// Nothing to test yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.fuin.objects4j.jackson.Objects4JJacksonAdapterModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@
*/
public final class AnnotationAnalyzer {

private static final Map<Class<?>, String> CLASS_NAME_MAP = new HashMap<Class<?>, String>();
private static final Map<Class<?>, String> CLASS_NAME_MAP = new HashMap<>();

static {
CLASS_NAME_MAP.put(String.class, String.class.getSimpleName());
CLASS_NAME_MAP.put(Byte.class, Byte.class.getSimpleName());
CLASS_NAME_MAP.put(Short.class, Short.class.getSimpleName());
CLASS_NAME_MAP.put(Integer.class, Integer.class.getSimpleName());
Expand Down Expand Up @@ -110,7 +109,7 @@ public final List<FieldTextInfo> createFieldInfos(@NotNull final Class<?> clasz,
Contract.requireArgNotNull("locale", locale);
Contract.requireArgNotNull("annotationClasz", annotationClasz);

final List<FieldTextInfo> infos = new ArrayList<FieldTextInfo>();
final List<FieldTextInfo> infos = new ArrayList<>();

final Field[] fields = clasz.getDeclaredFields();
for (final Field field : fields) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static List<TableColumnInfo> create(@NotNull final Class<?> clasz, @NotNu
Contract.requireArgNotNull("clasz", clasz);
Contract.requireArgNotNull("locale", locale);

final List<TableColumnInfo> list = new ArrayList<TableColumnInfo>();
final List<TableColumnInfo> list = new ArrayList<>();
final Field[] fields = clasz.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
final TableColumnInfo tableColumnInfo = create(fields[i], locale);
Expand Down
1 change: 1 addition & 0 deletions ui/src/main/java/org/fuin/objects4j/ui/TextFieldInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public final boolean equals(final Object obj) {
*
* @return Information or {@literal null}.
*/
@SuppressWarnings("java:S1172") // We will stay backward compatible with the "locale" parameter
public static TextFieldInfo create(@NotNull final Field field, @NotNull final Locale locale) {

final TextField textField = field.getAnnotation(TextField.class);
Expand Down

0 comments on commit 480439e

Please sign in to comment.