diff --git a/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonConfigurationService.java b/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonConfigurationService.java index 442c1d628..09eeda5a7 100644 --- a/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonConfigurationService.java +++ b/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonConfigurationService.java @@ -12,7 +12,7 @@ */ public class JacksonConfigurationService implements ConfigurationService { - private static final XMLUtil xmlUtil = new XMLUtil(); + private static final JacksonXMLMapper xmlUtil = new JacksonXMLMapper(); /** * {@inheritDoc} diff --git a/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/XMLUtil.java b/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonXMLMapper.java similarity index 83% rename from jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/XMLUtil.java rename to jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonXMLMapper.java index 35ac0a677..a73e6999b 100644 --- a/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/XMLUtil.java +++ b/jollyday-jackson/src/main/java/de/focus_shift/jollyday/jackson/JacksonXMLMapper.java @@ -1,12 +1,13 @@ package de.focus_shift.jollyday.jackson; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import de.focus_shift.jollyday.jackson.mapping.Configuration; import java.io.InputStream; -public class XMLUtil { +import static com.fasterxml.jackson.databind.PropertyNamingStrategies.UPPER_CAMEL_CASE; + +public class JacksonXMLMapper { private static final XmlMapper mapper = new JacksonMapperCreator().create(); @@ -28,7 +29,7 @@ public Configuration unmarshallConfiguration(InputStream stream) { private static class JacksonMapperCreator { private XmlMapper create() { final XmlMapper mapper = new XmlMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategies.UPPER_CAMEL_CASE); + mapper.setPropertyNamingStrategy(UPPER_CAMEL_CASE); return mapper; } } diff --git a/jollyday-jackson/src/test/java/de/focus_shift/jollyday/jackson/test/XMLUtilTest.java b/jollyday-jackson/src/test/java/de/focus_shift/jollyday/jackson/test/XMLUtilTest.java index 0f1643fdd..f01d365d5 100644 --- a/jollyday-jackson/src/test/java/de/focus_shift/jollyday/jackson/test/XMLUtilTest.java +++ b/jollyday-jackson/src/test/java/de/focus_shift/jollyday/jackson/test/XMLUtilTest.java @@ -1,6 +1,6 @@ package de.focus_shift.jollyday.jackson.test; -import de.focus_shift.jollyday.jackson.XMLUtil; +import de.focus_shift.jollyday.jackson.JacksonXMLMapper; import de.focus_shift.jollyday.jackson.mapping.Configuration; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -14,7 +14,7 @@ class XMLUtilTest { @ParameterizedTest @ValueSource(strings = {"Holidays_at.xml", "Holidays_de.xml", "Holidays_gb.xml", "Holidays_ua.xml", "Holidays_tr.xml", "Holidays_za.xml"}) void unmarshalRealResource(String holidayFileName) { - final XMLUtil sut = new XMLUtil(); + final JacksonXMLMapper sut = new JacksonXMLMapper(); final InputStream inputStream = getClass().getClassLoader().getResourceAsStream("holidays/" + holidayFileName); final Configuration configuration = sut.unmarshallConfiguration(inputStream); assertThat(configuration.getHolidays()).isNotNull(); diff --git a/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbConfigurationService.java b/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbConfigurationService.java index 232112999..2eb6043e5 100644 --- a/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbConfigurationService.java +++ b/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbConfigurationService.java @@ -12,7 +12,7 @@ */ public class JaxbConfigurationService implements ConfigurationService { - private static final XMLUtil xmlUtil = new XMLUtil(); + private static final JaxbXMLMapper xmlUtil = new JaxbXMLMapper(); /** * {@inheritDoc} diff --git a/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/XMLUtil.java b/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbXMLMapper.java similarity index 87% rename from jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/XMLUtil.java rename to jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbXMLMapper.java index bc6b588a5..560e23d74 100644 --- a/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/XMLUtil.java +++ b/jollyday-jaxb/src/main/java/de/focus_shift/jollyday/jaxb/JaxbXMLMapper.java @@ -12,14 +12,14 @@ import java.io.InputStream; -public class XMLUtil { +public class JaxbXMLMapper { /** * the package name to search for the generated java classes. */ private static final String PACKAGE = "de.focus_shift.jollyday.jaxb.mapping"; - private static final Logger LOG = LoggerFactory.getLogger(XMLUtil.class); + private static final Logger LOG = LoggerFactory.getLogger(JaxbXMLMapper.class); private static final JAXBContext jaxbContext = new JAXBContextCreator().create(); @@ -52,14 +52,14 @@ private JAXBContext create() { private static JAXBContext createJAXBContext() { JAXBContext ctx = null; try { - ctx = JAXBContext.newInstance(XMLUtil.PACKAGE, ClassLoadingUtil.getClassloader()); + ctx = JAXBContext.newInstance(JaxbXMLMapper.PACKAGE, ClassLoadingUtil.getClassloader()); } catch (JAXBException e) { LOG.warn("Could not create JAXB context using the current classloader from ClassLoadingUtil. Falling back to ObjectFactory class classloader."); } if (ctx == null) { try { - ctx = JAXBContext.newInstance(XMLUtil.PACKAGE, ObjectFactory.class.getClassLoader()); + ctx = JAXBContext.newInstance(JaxbXMLMapper.PACKAGE, ObjectFactory.class.getClassLoader()); } catch (JAXBException exception) { throw new IllegalStateException("Could not create JAXB context using ObjectFactory classloader.", exception); } diff --git a/jollyday-jaxb/src/test/java/de/focus_shift/jollyday/jaxb/test/XMLUtilTest.java b/jollyday-jaxb/src/test/java/de/focus_shift/jollyday/jaxb/test/XMLUtilTest.java index 1bc58da58..f2a5c1cde 100644 --- a/jollyday-jaxb/src/test/java/de/focus_shift/jollyday/jaxb/test/XMLUtilTest.java +++ b/jollyday-jaxb/src/test/java/de/focus_shift/jollyday/jaxb/test/XMLUtilTest.java @@ -1,6 +1,6 @@ package de.focus_shift.jollyday.jaxb.test; -import de.focus_shift.jollyday.jaxb.XMLUtil; +import de.focus_shift.jollyday.jaxb.JaxbXMLMapper; import de.focus_shift.jollyday.jaxb.mapping.Configuration; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -13,7 +13,7 @@ class XMLUtilTest { - private final XMLUtil sut = new XMLUtil(); + private final JaxbXMLMapper sut = new JaxbXMLMapper(); @Test void testUnmarshallConfigurationNullCheck() {