Repository: incubator-tamaya Updated Branches: refs/heads/java8 c4285641a -> 57211635f
TAMAYA-260: Fixed CDI issues regarding MP integration. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/57211635 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/57211635 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/57211635 Branch: refs/heads/java8 Commit: 57211635f7655f8d138218e4fe6ce547572a7802 Parents: c428564 Author: anatole <anat...@apache.org> Authored: Sun Aug 13 01:27:48 2017 +0200 Committer: anatole <anat...@apache.org> Committed: Sun Aug 13 01:27:48 2017 +0200 ---------------------------------------------------------------------- .../tamaya/core/internal/converters/OptionalConverter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/57211635/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OptionalConverter.java ---------------------------------------------------------------------- diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OptionalConverter.java b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OptionalConverter.java index 69595ac..e05e645 100644 --- a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OptionalConverter.java +++ b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/OptionalConverter.java @@ -23,6 +23,7 @@ import org.apache.tamaya.core.internal.PropertyConverterManager; import org.apache.tamaya.spi.ConversionContext; import org.apache.tamaya.spi.PropertyConverter; +import java.lang.reflect.Type; import java.util.Locale; import java.util.Objects; import java.util.Optional; @@ -39,8 +40,12 @@ public class OptionalConverter implements PropertyConverter<Optional> { public Optional<?> convert(String value, ConversionContext context) { TypeLiteral<Optional> target = (TypeLiteral<Optional>)context.getTargetType(); Object result = null; + Type targetType = TypeLiteral.getTypeParameters(target.getType())[0]; + if(String.class.equals(targetType)){ + result = value; + } for(PropertyConverter pv:context.getConfigurationContext().getPropertyConverters( - TypeLiteral.of(target.getType()))){ + TypeLiteral.of(targetType))){ result = pv.convert(value, context); if(result!=null){ return Optional.of(result);