You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/01/21 01:06:22 UTC

incubator-tamaya git commit: Fixed issues, merged code.

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 69d98e457 -> 806bc09f3


Fixed issues, merged code.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/806bc09f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/806bc09f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/806bc09f

Branch: refs/heads/master
Commit: 806bc09f3a697db38d0219a2752d16da7fff5065
Parents: 69d98e4
Author: anatole <an...@apache.org>
Authored: Wed Jan 21 01:06:13 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Wed Jan 21 01:06:13 2015 +0100

----------------------------------------------------------------------
 java8/api/pom.xml                               |  2 +-
 .../java/org/apache/tamaya/ConfigException.java | 10 ++--
 .../java/org/apache/tamaya/Configuration.java   | 51 ++++++++++++++------
 .../apache/tamaya/ConfigurationProvider.java    |  3 +-
 .../apache/tamaya/spi/ConfigurationContext.java | 26 +++++-----
 .../apache/tamaya/spi/PropertyConverter.java    |  3 +-
 .../org/apache/tamaya/spi/PropertyFilter.java   |  8 +--
 .../org/apache/tamaya/spi/PropertySource.java   | 22 +++++----
 .../tamaya/spi/PropertySourceProvider.java      |  6 +--
 .../org/apache/tamaya/spi/ServiceContext.java   | 23 +++++----
 .../tamaya/spi/ServiceContextManager.java       |  6 +--
 .../org/apache/tamaya/ConfigurationTest.java    | 18 +++----
 .../org/apache/tamaya/TestConfiguration.java    | 47 ++++++++----------
 .../apache/tamaya/spi/ServiceContextTest.java   |  7 ++-
 .../apache/tamaya/spi/TestServiceContext.java   | 24 ++++-----
 .../core/internal/converters/EnumConverter.java | 11 ++---
 16 files changed, 142 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/pom.xml
----------------------------------------------------------------------
diff --git a/java8/api/pom.xml b/java8/api/pom.xml
index d0f9fb4..b7d2d9a 100644
--- a/java8/api/pom.xml
+++ b/java8/api/pom.xml
@@ -16,7 +16,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/ConfigException.java b/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
index bac2ef4..e3b6fb8 100644
--- a/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
+++ b/java8/api/src/main/java/org/apache/tamaya/ConfigException.java
@@ -21,24 +21,26 @@ package org.apache.tamaya;
 /**
  * Exception class (runtime exception) for configuration issues.
  */
-public class ConfigException extends RuntimeException{
+public class ConfigException extends RuntimeException {
 
     private static final long serialVersionUID = -5886094818057522680L;
 
     /**
      * Creates a new configuration exception.
+     *
      * @param message the exception message, not null.
      */
-    public ConfigException(String message){
+    public ConfigException(String message) {
         super(message);
     }
 
     /**
      * Creates a new configuration exception.
+     *
      * @param message the exception message, not null.
-     * @param t the throwable.
+     * @param t       the throwable.
      */
-    public ConfigException(String message, Throwable t){
+    public ConfigException(String message, Throwable t) {
         super(message, t);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/Configuration.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/Configuration.java b/java8/api/src/main/java/org/apache/tamaya/Configuration.java
index 2335e4b..ed1f918 100644
--- a/java8/api/src/main/java/org/apache/tamaya/Configuration.java
+++ b/java8/api/src/main/java/org/apache/tamaya/Configuration.java
@@ -48,6 +48,16 @@ import java.util.function.Function;
 public interface Configuration {
 
     /**
+     * Access a configuration.
+     *
+     * @return the corresponding Configuration instance, never null.
+     * @throws ConfigException if no such configuration is defined.
+     */
+    public static Configuration current() {
+        return ServiceContext.getInstance().getService(Configuration.class).get();
+    }
+
+    /**
      * Access a property.
      *
      * @param key the property's key, not null.
@@ -55,6 +65,32 @@ public interface Configuration {
      */
     String get(String key);
 
+//    /**
+//     * Get the property keys as type T. This will implicitly require a corresponding {@link
+//     * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
+//     * fromMap the given String keys.
+//     *
+//     * @param key      the property's absolute, or relative path, e.g. @code
+//     *                 a/b/c/d.myProperty}.
+//     * @param type     The target type required, not null.
+//     * @return the property value, never null..
+//     * @throws ConfigException if the keys could not be converted to the required target type.
+//     */
+//    <T> T getListProperty(String key, TypeLiteral<T> type);
+//
+//    /**
+//     * Get the property keys as type T. This will implicitly require a corresponding {@link
+//     * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
+//     * fromMap the given String keys.
+//     *
+//     * @param key       the property's absolute, or relative path, e.g. @code
+//     *                  a/b/c/d.myProperty}.
+//     * @param converter the converter to be used.
+//     * @return the property value, never null..
+//     * @throws ConfigException if the keys could not be converted to the required target type.
+//     */
+//    <T> T getListProperty(String key, Function<List<String>, T> converter);
+
     /**
      * Get the property keys as type T. This will implicitly require a corresponding {@link
      * org.apache.tamaya.spi.PropertyConverter} to be available that is capable current providing type T
@@ -157,7 +193,6 @@ public interface Configuration {
         return OptionalInt.empty();
     }
 
-
     /**
      * Get the property keys as {@link Long}.
      *
@@ -174,7 +209,6 @@ public interface Configuration {
         return OptionalLong.empty();
     }
 
-
     /**
      * Get the property keys as {@link Double}.
      *
@@ -192,7 +226,6 @@ public interface Configuration {
         return OptionalDouble.empty();
     }
 
-
     /**
      * Extension point for adjusting configuration.
      *
@@ -204,7 +237,6 @@ public interface Configuration {
         return operator.operate(this);
     }
 
-
     /**
      * Query a configuration.
      *
@@ -215,15 +247,4 @@ public interface Configuration {
         return query.query(this);
     }
 
-
-    /**
-     * Access a configuration.
-     *
-     * @return the corresponding Configuration instance, never null.
-     * @throws ConfigException if no such configuration is defined.
-     */
-    public static Configuration current() {
-        return ServiceContext.getInstance().getService(Configuration.class).get();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
index 6d37e57..7a64caa 100644
--- a/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ b/java8/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -20,8 +20,9 @@ import org.apache.tamaya.spi.ServiceContextManager;
 
 /**
  * Static access to the {@link org.apache.tamaya.Configuration} for the very application.
- *
+ * <p>
  * Exists for Java7 backward compatibility only.
+ *
  * @deprecated Since Java 8, you better use {@link org.apache.tamaya.Configuration#current()}.
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
index 7b51717..e5d9ece 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -29,6 +29,10 @@ import java.util.Map;
  */
 public interface ConfigurationContext {
 
+    public static ConfigurationContext context() {
+        return ServiceContext.getInstance().getService(ConfigurationContext.class).get();
+    }
+
     /**
      * This method can be used for programmatically adding {@link PropertySource}s.
      * It is not needed for normal 'usage' by end users, but only for Extension Developers!
@@ -51,12 +55,11 @@ public interface ConfigurationContext {
      */
     List<PropertySource> getPropertySources();
 
-
     /**
      * This method can be used for programmatically adding {@link PropertyConverter}s.
      * It is not needed for normal 'usage' by end users, but only for Extension Developers!
      *
-     * @param typeToConvert the type which the converter is for
+     * @param typeToConvert     the type which the converter is for
      * @param propertyConverter the PropertyConverters to add for this type
      */
     <T> void addPropertyConverter(Class<T> typeToConvert, PropertyConverter<T> propertyConverter);
@@ -88,7 +91,7 @@ public interface ConfigurationContext {
      * This method returns the registered PropertyConverters for a given type.
      * The List for each type is ordered via their {@link javax.annotation.Priority}.
      * </p>
-     *
+     * <p>
      * <p>
      * PropertyConverters with a higher Priority come first. The PropertyConverter with the
      * lowest Priority comes last.
@@ -96,20 +99,20 @@ public interface ConfigurationContext {
      * using their class name just to ensure the user at least gets the same ordering
      * after a JVM restart.
      * </p>
-     *
+     * <p>
      * <p>
      * Additionally if a PropertyProvider is accessed, which is not registered the implementation
      * should try to figure out, if there could be a default implementation as follows:
      * <ol>
-     *     <le>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
-     *     instanceOf(String), fomr(String)}</le>
-     *     <le>Look for a matching constructor: {@code T(String)}.</le>
+     * <le>Look for static factory methods: {@code of(String), valueOf(String), getInstance(String),
+     * instanceOf(String), fomr(String)}</le>
+     * <le>Look for a matching constructor: {@code T(String)}.</le>
      * </ol>
      * If a correspoding factory method or constructor could be found, a corresponding
      * PropertyConverter should be created and registered automatically for the given
      * type.
      * </p>
-     *
+     * <p>
      * <p>
      * The scenario could be like:
      * <pre>
@@ -120,7 +123,7 @@ public interface ConfigurationContext {
      *  }
      * </pre>
      * </p>
-     *
+     * <p>
      * <p>
      * The converters returned for a type should be used as a chain, whereas the result of the
      * first converter that is able to convert the configured value, is taken as the chain's result.
@@ -134,12 +137,9 @@ public interface ConfigurationContext {
 
     /**
      * Access the current PropertyFilter instances.
+     *
      * @return the list of registered PropertyFilters, never null.
      */
     List<PropertyFilter> getPropertyFilters();
 
-    public static ConfigurationContext context(){
-        return ServiceContext.getInstance().getService(ConfigurationContext.class).get();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java b/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
index e237aa9..a492424 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/PropertyConverter.java
@@ -24,10 +24,11 @@ package org.apache.tamaya.spi;
  * This is used for implementing type conversion from a property (String) to a certain target
  * type. Hereby the target type can be multivalued (eg collections) or complex if needed.
  */
-public interface PropertyConverter<T>{
+public interface PropertyConverter<T> {
 
     /**
      * Convert the given configuration keys from it's String representation into the required target type.
+     *
      * @param value the configuration value
      * @return the converted value
      */

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java b/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
index d106e70..1fd8c36 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/PropertyFilter.java
@@ -25,7 +25,7 @@ package org.apache.tamaya.spi;
  * hereby is defined by the corresponding {@code @Priority} annotation.</p>
  * <p>Filters </p>
  */
-public interface PropertyFilter{
+public interface PropertyFilter {
 
     /**
      * <p>Maps the current {@code valueToBeFiltered} value to a new value. The resulting value will be used as the result
@@ -36,11 +36,11 @@ public interface PropertyFilter{
      * <h3>Implementation specification</h3>
      * Implementations of this class must be
      * <ul>
-     *     <li>reentrant</li>
-     *     <li>thread-safe</li>
+     * <li>reentrant</li>
+     * <li>thread-safe</li>
      * </ul>
      *
-     * @param key the key accessed, not null.
+     * @param key               the key accessed, not null.
      * @param valueToBeFiltered the value to be filtered, not null.
      * @return the filtered value, or {@code null} if the value should be removed alltogether.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java b/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
index e91906a..270a1ff 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/PropertySource.java
@@ -57,10 +57,10 @@ public interface PropertySource {
      * TODO rethink whole default PropertySources and ordering:
      * TODO introduce default values or constants for ordinals
      * <ol>
-     *     <li>System properties (ordinal 400)</li>
-     *     <li>Environment properties (ordinal 300)</li>
-     *     <li>JNDI values (ordinal 200)</li>
-     *     <li>Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)</li>
+     * <li>System properties (ordinal 400)</li>
+     * <li>Environment properties (ordinal 300)</li>
+     * <li>JNDI values (ordinal 200)</li>
+     * <li>Properties file values (/META-INF/applicationConfiguration.properties) (ordinal 100)</li>
      * </ol>
      * <p/>
      * <p><b>Important Hints for custom implementations</b>:</p>
@@ -87,16 +87,18 @@ public interface PropertySource {
      * Get the name of the property source. The name should be unique for the type of source, whereas multiple instances
      * of the same type (and thus name) may exist in a system. Give a {@link org.apache.tamaya.spi.ConfigurationContext}
      * the name of a PropertySource is unique.
+     *
      * @return the property source's name, never null.
      */
-    default String getName(){
+    default String getName() {
         return getClass().getName();
     }
 
     /**
      * Access a property.
-     *
+     * <p>
      * //X TODO discuss if the key can be null
+     *
      * @param key the property's key, not null.
      * @return the value assigned to the property or {@code null}. An empty String will kind of 'erase' previous values.
      */
@@ -109,11 +111,11 @@ public interface PropertySource {
      * @return the a corresponding map, never null.
      * //X TODO or should we just do getPropertyKeys()? Think about security (key) vs easier merging (full map)?
      */
-    Map<String,String> getProperties();
+    Map<String, String> getProperties();
 
     /**
      * Determines if this config source could be scanned for its list of properties.
-     *
+     * <p>
      * <p>
      * PropertySources which are not scannable might not be able to find all the
      * configured values to provide via {@link #getProperties()}. This can e.g. happen
@@ -121,9 +123,9 @@ public interface PropertySource {
      * </p>
      *
      * @return {@code true} if this PropertySource could be scanned for its list of properties,
-     *         {@code false} if it should not be scanned.
+     * {@code false} if it should not be scanned.
      */
-    default boolean isScannable(){
+    default boolean isScannable() {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java b/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
index 42e3b4d..81ddcdd 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/PropertySourceProvider.java
@@ -24,11 +24,11 @@ import java.util.Collection;
  * <p>Implement this interfaces to provide a PropertySource provider which
  * is able to register multiple PropertySources. This is e.g. needed if
  * there are multiple property files of a given config file name.</p>
- * 
+ * <p>
  * <p>If a PropertySource like JNDI only exists once, then there is no need
  * to implement it via the PropertySourceProvider but should directly
  * expose a {@link PropertySource}.</p>
- *
+ * <p>
  * <p>A PropertySourceProvider will get picked up via the
  * {@link java.util.ServiceLoader} mechanism and must get registered via
  * META-INF/services/org.apache.tamaya.spi.PropertySourceProvider</p>
@@ -37,7 +37,7 @@ public interface PropertySourceProvider {
 
     /**
      * @return For each e.g. property file, we return a single PropertySource
-     *         or an empty list if no PropertySource exists.
+     * or an empty list if no PropertySource exists.
      */
     Collection<PropertySource> getPropertySources();
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java b/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
index f7817e7..e063b5f 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContext.java
@@ -29,6 +29,15 @@ import java.util.Optional;
 public interface ServiceContext {
 
     /**
+     * Get the current {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
+     *
+     * @return the {@link ServiceContext} to be used.
+     */
+    public static ServiceContext getInstance() {
+        return ServiceContextManager.getServiceContext();
+    }
+
+    /**
      * @return ordinal of the ServiceContext. The one with the highest ordinal will be taken.
      */
     default int ordinal() {
@@ -51,18 +60,8 @@ public interface ServiceContext {
      * order the instance for precedence, hereby the most significant should be
      * first in order.
      *
-     * @param serviceType
-     *            the service type.
+     * @param serviceType the service type.
      * @return The instance to be used, never {@code null}
      */
-     <T> List<T> getServices(Class<T> serviceType);
-
-    /**
-     * Get the current {@link ServiceContext}. If necessary the {@link ServiceContext} will be laziliy loaded.
-     *
-     * @return the {@link ServiceContext} to be used.
-     */
-    public static ServiceContext getInstance(){
-        return ServiceContextManager.getServiceContext();
-    }
+    <T> List<T> getServices(Class<T> serviceType);
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java b/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
index 11648a4..93d293b 100644
--- a/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
+++ b/java8/api/src/main/java/org/apache/tamaya/spi/ServiceContextManager.java
@@ -18,13 +18,13 @@
  */
 package org.apache.tamaya.spi;
 
+import org.apache.tamaya.ConfigException;
+
 import java.util.Objects;
 import java.util.ServiceLoader;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.tamaya.ConfigException;
-
 
 /**
  * This singleton provides access to the services available in the current {@link ServiceContext}. The
@@ -60,7 +60,7 @@ public final class ServiceContextManager {
         } catch (Exception e) {
             throw new ConfigException("ServiceContext not loadable", e);
         }
-        if(highestServiceContext==null){
+        if (highestServiceContext == null) {
             throw new ConfigException("No ServiceContext found");
         }
         return highestServiceContext;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java b/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
index c102855..1ca8d29 100644
--- a/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
+++ b/java8/api/src/test/java/org/apache/tamaya/ConfigurationTest.java
@@ -30,11 +30,11 @@ public class ConfigurationTest {
     public void testget() throws Exception {
         assertEquals(Boolean.TRUE, Configuration.current().getOptional("booleanTrue", (s) -> Boolean.valueOf(s)).get());
         assertEquals(Boolean.FALSE, Configuration.current().getOptional("booleanFalse", (s) -> Boolean.valueOf(s)).get());
-        assertEquals((int)Byte.MAX_VALUE, (int)Configuration.current().getOptional("byte", (s) -> Byte.valueOf(s)).get());
-        assertEquals((int)Integer.MAX_VALUE, (int)Configuration.current().getOptional("int", (s) -> Integer.valueOf(s)).get());
-        assertEquals((long)Long.MAX_VALUE, (long)Configuration.current().getOptional("long", (s) -> Long.valueOf(s)).get());
-        assertEquals((double)Float.MAX_VALUE, (double)Configuration.current().getOptional("float", (s) -> Float.valueOf(s)).get(), 0.0d);
-        assertEquals((double)Double.MAX_VALUE, (double)Configuration.current().getOptional("double", (s) -> Double.valueOf(s)).get(), 0.0d);
+        assertEquals((int) Byte.MAX_VALUE, (int) Configuration.current().getOptional("byte", (s) -> Byte.valueOf(s)).get());
+        assertEquals((int) Integer.MAX_VALUE, (int) Configuration.current().getOptional("int", (s) -> Integer.valueOf(s)).get());
+        assertEquals((long) Long.MAX_VALUE, (long) Configuration.current().getOptional("long", (s) -> Long.valueOf(s)).get());
+        assertEquals((double) Float.MAX_VALUE, (double) Configuration.current().getOptional("float", (s) -> Float.valueOf(s)).get(), 0.0d);
+        assertEquals((double) Double.MAX_VALUE, (double) Configuration.current().getOptional("double", (s) -> Double.valueOf(s)).get(), 0.0d);
     }
 
     @org.junit.Test
@@ -46,22 +46,22 @@ public class ConfigurationTest {
 
     @org.junit.Test
     public void testGetInteger() throws Exception {
-        assertEquals(Integer.MAX_VALUE,Configuration.current().getInteger("int").getAsInt());
+        assertEquals(Integer.MAX_VALUE, Configuration.current().getInteger("int").getAsInt());
     }
 
     @org.junit.Test
     public void testGetLong() throws Exception {
-        assertEquals(Long.MAX_VALUE,Configuration.current().getLong("long").getAsLong());
+        assertEquals(Long.MAX_VALUE, Configuration.current().getLong("long").getAsLong());
     }
 
     @org.junit.Test
     public void testGetDouble() throws Exception {
-        assertEquals(Double.MAX_VALUE,Configuration.current().getDouble("double").getAsDouble(), 0.0d);
+        assertEquals(Double.MAX_VALUE, Configuration.current().getDouble("double").getAsDouble(), 0.0d);
     }
 
     @org.junit.Test
     public void testWith() throws Exception {
-        assertEquals(Configuration.current(), Configuration.current().with(c-> c));
+        assertEquals(Configuration.current(), Configuration.current().with(c -> c));
     }
 
     @org.junit.Test

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
index ac3b646..c572dff 100644
--- a/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ b/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -27,6 +27,7 @@ import java.util.Map;
 public class TestConfiguration implements Configuration {
 
     private static final Map<String, String> VALUES;
+
     static {
         VALUES = new HashMap<String, String>();
         VALUES.put("long", String.valueOf(Long.MAX_VALUE));
@@ -47,34 +48,26 @@ public class TestConfiguration implements Configuration {
 
     @Override
     public <T> T get(String key, Class<T> type) {
-        if(type.equals(Long.class)){
-            return (T)(Object)Long.MAX_VALUE;
-        }
-        else if(type.equals(Integer.class)){
-            return (T)(Object) Integer.MAX_VALUE;
-        }
-        else if(type.equals(Double.class)){
-            return (T)(Object) Double.MAX_VALUE;
-        }
-        else if(type.equals(Float.class)){
-            return (T)(Object) Float.MAX_VALUE;
-        }
-        else if(type.equals(Short.class)){
-            return (T)(Object) Short.MAX_VALUE;
-        }
-        else if(type.equals(Byte.class)){
-            return (T)(Object) Byte.MAX_VALUE;
-        }
-        else if(type.equals(Boolean.class)){
-            if("booleanTrue".equals(key)) {
-                return (T)(Object) Boolean.TRUE;
+        if (type.equals(Long.class)) {
+            return (T) (Object) Long.MAX_VALUE;
+        } else if (type.equals(Integer.class)) {
+            return (T) (Object) Integer.MAX_VALUE;
+        } else if (type.equals(Double.class)) {
+            return (T) (Object) Double.MAX_VALUE;
+        } else if (type.equals(Float.class)) {
+            return (T) (Object) Float.MAX_VALUE;
+        } else if (type.equals(Short.class)) {
+            return (T) (Object) Short.MAX_VALUE;
+        } else if (type.equals(Byte.class)) {
+            return (T) (Object) Byte.MAX_VALUE;
+        } else if (type.equals(Boolean.class)) {
+            if ("booleanTrue".equals(key)) {
+                return (T) (Object) Boolean.TRUE;
+            } else {
+                return (T) (Object) Boolean.FALSE;
             }
-            else{
-                return (T)(Object) Boolean.FALSE;
-            }
-        }
-        else if(type.equals(String.class)){
-            return (T)(Object) "aStringValue";
+        } else if (type.equals(String.class)) {
+            return (T) (Object) "aStringValue";
         }
         throw new ConfigException("No such property: " + key);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
----------------------------------------------------------------------
diff --git a/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java b/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
index 5ebfc19..cbfd1d5 100644
--- a/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
+++ b/java8/api/src/test/java/org/apache/tamaya/spi/ServiceContextTest.java
@@ -27,15 +27,14 @@ import java.util.List;
 import java.util.Optional;
 
 import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
 
 public class ServiceContextTest {
 
-    private ServiceContext serviceContext = new ServiceContext(){
+    private ServiceContext serviceContext = new ServiceContext() {
 
         @Override
         public <T> Optional<T> getService(Class<T> serviceType) {
-            if(String.class.equals(serviceType)){
+            if (String.class.equals(serviceType)) {
                 return Optional.of(serviceType.cast("ServiceContextTest"));
             }
             return Optional.empty();
@@ -43,7 +42,7 @@ public class ServiceContextTest {
 
         @Override
         public <T> List<T> getServices(Class<T> serviceType) {
-            if(String.class.equals(serviceType)){
+            if (String.class.equals(serviceType)) {
                 List<String> list = new ArrayList<>();
                 list.add("ServiceContextTest");
                 return List.class.cast(list);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
----------------------------------------------------------------------
diff --git a/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java b/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
index 665c99f..856530d 100644
--- a/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
+++ b/java8/api/src/test/java/org/apache/tamaya/spi/TestServiceContext.java
@@ -33,20 +33,23 @@ import java.util.logging.Logger;
  * {@link java.util.ServiceLoader} to load the services required.
  */
 public final class TestServiceContext implements ServiceContext {
-    /** List current services loaded, per class. */
+    /**
+     * List current services loaded, per class.
+     */
     private final ConcurrentHashMap<Class, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
-    /** Singletons. */
+    /**
+     * Singletons.
+     */
     private final Map<Class, Optional<?>> singletons = new ConcurrentHashMap<>();
 
     @Override
     public <T> Optional<T> getService(Class<T> serviceType) {
         Optional<T> cached = Optional.class.cast(singletons.get(serviceType));
-        if(cached==null) {
+        if (cached == null) {
             List<? extends T> services = getServices(serviceType);
             if (services.isEmpty()) {
                 cached = Optional.empty();
-            }
-            else{
+            } else {
                 cached = Optional.of(services.get(0));
             }
             singletons.put(serviceType, cached);
@@ -57,10 +60,9 @@ public final class TestServiceContext implements ServiceContext {
     /**
      * Loads and registers services.
      *
-     * @param   serviceType  The service type.
-     * @param   <T>          the concrete type.
-     *
-     * @return  the items found, never {@code null}.
+     * @param serviceType The service type.
+     * @param <T>         the concrete type.
+     * @return the items found, never {@code null}.
      */
     @Override
     public <T> List<T> getServices(Class<T> serviceType) {
@@ -70,11 +72,11 @@ public final class TestServiceContext implements ServiceContext {
                 services.add(t);
             }
             services = Collections.unmodifiableList(services);
-            final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>)services));
+            final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>) services));
             return previousServices != null ? previousServices : services;
         } catch (Exception e) {
             Logger.getLogger(TestServiceContext.class.getName()).log(Level.WARNING,
-                                      "Error loading services current type " + serviceType, e);
+                    "Error loading services current type " + serviceType, e);
             return Collections.EMPTY_LIST;
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/806bc09f/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
----------------------------------------------------------------------
diff --git a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
index b7d1869..902ce87 100644
--- a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
+++ b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/EnumConverter.java
@@ -21,6 +21,7 @@ package org.apache.tamaya.core.internal.converters;
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.spi.PropertyConverter;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Objects;
 import java.util.logging.Logger;
@@ -47,16 +48,12 @@ public class EnumConverter<T> implements PropertyConverter<T> {
     }
 
     @Override
-    public Class<T> getTargetType() {
-        return enumType;
-    }
-
-    @Override
     public T convert(String value) {
         try {
             return (T) factory.invoke(null, value);
-        } catch (Exception e) {
-            throw new ConfigException("Invalid enum value '" + value + "' for " + enumType.getName());
+        }
+        catch (InvocationTargetException | IllegalAccessException e) {
+            throw new ConfigException("Invalid enum value '" + value + "' for " + enumType.getName(), e);
         }
 
     }