From 08a5606da6bf5df94c0afa72ad8b5e5c3f60c58f Mon Sep 17 00:00:00 2001 From: Thilo Schwarz Date: Mon, 24 Mar 2025 15:49:43 +0100 Subject: [PATCH] reduce code smells --- .../java/codes/thischwa/cf/CfBasicHttpClient.java | 12 ++++++------ src/main/java/codes/thischwa/cf/CfRequest.java | 4 ++-- .../thischwa/cf/model/AbstractMultipleResponse.java | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/codes/thischwa/cf/CfBasicHttpClient.java b/src/main/java/codes/thischwa/cf/CfBasicHttpClient.java index 51aebd4..13c165a 100644 --- a/src/main/java/codes/thischwa/cf/CfBasicHttpClient.java +++ b/src/main/java/codes/thischwa/cf/CfBasicHttpClient.java @@ -48,12 +48,12 @@ abstract class CfBasicHttpClient { } private ObjectMapper initObjectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); - return objectMapper; + ObjectMapper mapper = new ObjectMapper(); + mapper.registerModule(new JavaTimeModule()); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); + return mapper; } private CloseableHttpClient createHttpClient() { diff --git a/src/main/java/codes/thischwa/cf/CfRequest.java b/src/main/java/codes/thischwa/cf/CfRequest.java index 69a3a00..cebdcdf 100644 --- a/src/main/java/codes/thischwa/cf/CfRequest.java +++ b/src/main/java/codes/thischwa/cf/CfRequest.java @@ -52,7 +52,7 @@ public enum CfRequest { */ RECORD_DELETE("/zones/%s/dns_records/%s"); - private static final char varIdentification = '%'; + private static final char VAR_IDENTIFICATION = '%'; private final String path; CfRequest(String path) { @@ -68,7 +68,7 @@ public enum CfRequest { * @return the fully constructed API endpoint path as a string. */ String buildPath(Object... vars) { - long varCount = path.chars().filter(c -> c == varIdentification).count(); + long varCount = path.chars().filter(c -> c == VAR_IDENTIFICATION).count(); if (varCount != vars.length) { throw new IllegalArgumentException( String.format( diff --git a/src/main/java/codes/thischwa/cf/model/AbstractMultipleResponse.java b/src/main/java/codes/thischwa/cf/model/AbstractMultipleResponse.java index ed00d35..2235e69 100644 --- a/src/main/java/codes/thischwa/cf/model/AbstractMultipleResponse.java +++ b/src/main/java/codes/thischwa/cf/model/AbstractMultipleResponse.java @@ -39,7 +39,7 @@ public abstract class AbstractMultipleResponse extends * constructor of the superclass {@code AbstractResponse}. This constructor is typically used for * deserialization or subclass instantiation. */ - public AbstractMultipleResponse() { + AbstractMultipleResponse() { super(); } }