[nuiton-converter] branch develop updated (2e2d1ce -> f4e2330)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository nuiton-converter. See http://git.nuiton.org/nuiton-converter.git from 2e2d1ce - Introduce a NuitonConverter to get converter type and avoid any weak reflection - Write javadoc in english - Clean code new 5f21c9c use site descriptor from pom project new 683a71d Improve code (thanks to Sonar) new f4e2330 Merge branch 'testSite' into develop The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit f4e233031022bd24eb1795f66a8b6d1ab2ae7209 Merge: 2e2d1ce 683a71d Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Jul 23 21:45:21 2014 +0200 Merge branch 'testSite' into develop commit 683a71d3d648a0af83f5d8fe79a4419d03070f49 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Jul 23 21:42:51 2014 +0200 Improve code (thanks to Sonar) commit 5f21c9c5d2c20e0d4c776b82b01a0a4741452a85 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Jul 23 21:42:30 2014 +0200 use site descriptor from pom project Summary of changes: pom.xml | 2 +- .../java/org/nuiton/converter/ConverterUtil.java | 26 +++++++++---------- .../java/org/nuiton/converter/EnumConverter.java | 2 +- .../java/org/nuiton/converter/LocaleConverter.java | 6 ++--- .../java/org/nuiton/converter/NuitonConverter.java | 22 ++++++++++++++++ src/site/site.xml | 30 ---------------------- 6 files changed, 40 insertions(+), 48 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-converter. See http://git.nuiton.org/nuiton-converter.git commit 5f21c9c5d2c20e0d4c776b82b01a0a4741452a85 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Jul 23 21:42:30 2014 +0200 use site descriptor from pom project --- pom.xml | 2 +- src/site/site.xml | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index 860818d..a047aa6 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>nuitonpom</artifactId> - <version>1.1</version> + <version>1.2-SNAPSHOT</version> </parent> <artifactId>nuiton-converter</artifactId> diff --git a/src/site/site.xml b/src/site/site.xml index efe2b01..a944a7d 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -25,26 +25,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.4.0 http://maven.apache.org/xsd/decoration-1.4.0.xsd"> - <skin> - <groupId>org.apache.maven.skins</groupId> - <artifactId>maven-fluido-skin</artifactId> - <version>${fluidoSkinVersion}</version> - </skin> - - <custom> - <fluidoSkin> - <topBarEnabled>false</topBarEnabled> - <googleSearch/> - <sideBarEnabled>true</sideBarEnabled> - <searchEnabled>true</searchEnabled> - <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled> - <piwik> - <piwikUrl>http://piwik.codelutin.com</piwikUrl> - <idsite>${project.piwikId}</idsite> - </piwik> - </fluidoSkin> - </custom> - <bannerLeft> <name>${project.name}</name> <href>index.html</href> @@ -55,16 +35,6 @@ <href>https://www.codelutin.com</href> </bannerRight> - <publishDate position="right"/> - <version position="right"/> - - <poweredBy> - - <logo href="http://maven.apache.org" name="Maven" - img="${siteCommonResourcesUrl}/images/logos/maven-feather.png"/> - - </poweredBy> - <body> <links> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-converter. See http://git.nuiton.org/nuiton-converter.git commit 683a71d3d648a0af83f5d8fe79a4419d03070f49 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Jul 23 21:42:51 2014 +0200 Improve code (thanks to Sonar) --- .../java/org/nuiton/converter/ConverterUtil.java | 26 +++++++++++----------- .../java/org/nuiton/converter/EnumConverter.java | 2 +- .../java/org/nuiton/converter/LocaleConverter.java | 6 ++--- .../java/org/nuiton/converter/NuitonConverter.java | 22 ++++++++++++++++++ 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/nuiton/converter/ConverterUtil.java b/src/main/java/org/nuiton/converter/ConverterUtil.java index 4b9f33f..66dd9a8 100644 --- a/src/main/java/org/nuiton/converter/ConverterUtil.java +++ b/src/main/java/org/nuiton/converter/ConverterUtil.java @@ -39,7 +39,7 @@ import java.util.ServiceLoader; public class ConverterUtil { /** Logger. */ - static private Log log = LogFactory.getLog(ConverterUtil.class); + private static final Log LOGGER = LogFactory.getLog(ConverterUtil.class); /** * Default package where to find the converter. @@ -52,7 +52,7 @@ public class ConverterUtil { * <p/> * Method {@link #deregister()} will set back the flag value to {@code false}. */ - protected static Boolean WAS_INIT = Boolean.FALSE; + static Boolean wasInit = Boolean.FALSE; /** * Try to find amatching converter for the given {@code type}. @@ -71,7 +71,7 @@ public class ConverterUtil { * @return the found converter, or {@code null} if not found */ public static <T> Converter getConverter(Class<T> type) { - if (!WAS_INIT) { + if (!wasInit) { initConverters(); } Converter converter = ConvertUtils.lookup(type); @@ -105,7 +105,7 @@ public class ConverterUtil { * @return the converted data or {@code null} if no converter found for the type of data. */ public static <T> T convert(Class<T> type, Object toConvert) { - if (!WAS_INIT) { + if (!wasInit) { initConverters(); } T result = null; @@ -132,7 +132,7 @@ public class ConverterUtil { Class<?> aClass = Class.forName( CONVERTER_PACKAGE + "." + type.getSimpleName() + "Converter"); Converter converter = (Converter) aClass.newInstance(); - log.info("for type : " + type + " : " + converter); + LOGGER.info("for type : " + type + " : " + converter); ConvertUtils.register(converter, type); } @@ -148,7 +148,7 @@ public class ConverterUtil { Object defaultValue) { if (EnumConverter.isEnabled(type, type) && ConvertUtils.lookup(type) == null) { Converter converter = new EnumConverter<E>(type, defaultValue); - log.info("for type : " + type + " : " + converter); + LOGGER.info("for type : " + type + " : " + converter); ConvertUtils.register(converter, type); } } @@ -188,7 +188,7 @@ public class ConverterUtil { */ public static synchronized void deregister() { ConvertUtils.deregister(); - WAS_INIT = false; + wasInit = false; } /** @@ -197,21 +197,21 @@ public class ConverterUtil { * If was already init, then will do nothing. * <p/> * Note: the {@link #getConverter(Class)} or {@link #convert(Class, Object)} methods always invoke this method if - * the class was not initialized (see the {@link #WAS_INIT} internal flag). + * the class was not initialized (see the {@link #wasInit} internal flag). */ public static synchronized void initConverters() { - if (WAS_INIT != null && WAS_INIT) { + if (wasInit != null && wasInit) { return; } ServiceLoader<NuitonConverter> converters = ServiceLoader.load(NuitonConverter.class); for (NuitonConverter converter : converters) { - if (log.isDebugEnabled()) { - log.debug("discovered converter " + converter); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("discovered converter " + converter); } Class<?> type = converter.getType(); - log.info("register converter " + converter); + LOGGER.info("register converter " + converter); ConvertUtils.register(converter, type); } - WAS_INIT = true; + wasInit = true; } } diff --git a/src/main/java/org/nuiton/converter/EnumConverter.java b/src/main/java/org/nuiton/converter/EnumConverter.java index e89c958..2b00455 100644 --- a/src/main/java/org/nuiton/converter/EnumConverter.java +++ b/src/main/java/org/nuiton/converter/EnumConverter.java @@ -117,7 +117,7 @@ public class EnumConverter<E extends Enum> implements NuitonConverter<E> { } protected static boolean isEnabled(Class<?> aClass, Class<?> enumType) { - return aClass != null && aClass.isEnum() && aClass == enumType; + return aClass != null && aClass.isEnum() && aClass.equals(enumType); } protected Object convertFromOrdinal(Class<?> aClass, Object value) { diff --git a/src/main/java/org/nuiton/converter/LocaleConverter.java b/src/main/java/org/nuiton/converter/LocaleConverter.java index 51595a3..f8f7ba4 100644 --- a/src/main/java/org/nuiton/converter/LocaleConverter.java +++ b/src/main/java/org/nuiton/converter/LocaleConverter.java @@ -46,7 +46,7 @@ public class LocaleConverter implements NuitonConverter<Locale> { Pattern.compile("([a-zA-Z]{2})"); /** Logger. */ - private static final Log log = getLog(LocaleConverter.class); + private static final Log LOGGER = getLog(LocaleConverter.class); @Override public <T> T convert(Class<T> aClass, Object value) { @@ -116,8 +116,8 @@ public class LocaleConverter implements NuitonConverter<Locale> { public LocaleConverter() { - if (log.isDebugEnabled()) { - log.debug("init locale converter : " + this); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("init locale converter : " + this); } } diff --git a/src/main/java/org/nuiton/converter/NuitonConverter.java b/src/main/java/org/nuiton/converter/NuitonConverter.java index bab9bbe..7b6232b 100644 --- a/src/main/java/org/nuiton/converter/NuitonConverter.java +++ b/src/main/java/org/nuiton/converter/NuitonConverter.java @@ -1,5 +1,27 @@ package org.nuiton.converter; +/* + * #%L + * Nuiton Converter + * %% + * Copyright (C) 2014 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import org.apache.commons.beanutils.Converter; /** -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository nuiton-converter. See http://git.nuiton.org/nuiton-converter.git commit f4e233031022bd24eb1795f66a8b6d1ab2ae7209 Merge: 2e2d1ce 683a71d Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Jul 23 21:45:21 2014 +0200 Merge branch 'testSite' into develop pom.xml | 2 +- .../java/org/nuiton/converter/ConverterUtil.java | 26 +++++++++---------- .../java/org/nuiton/converter/EnumConverter.java | 2 +- .../java/org/nuiton/converter/LocaleConverter.java | 6 ++--- .../java/org/nuiton/converter/NuitonConverter.java | 22 ++++++++++++++++ src/site/site.xml | 30 ---------------------- 6 files changed, 40 insertions(+), 48 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm