You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2018/03/16 17:43:00 UTC
[jira] [Commented] (JOHNZON-162) support 'implicit converters' for
certain types
[ https://issues.apache.org/jira/browse/JOHNZON-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16402243#comment-16402243 ]
Mark Struberg commented on JOHNZON-162:
---------------------------------------
Thinking through this it might become much more complicated. For example: currently we drill down to attributes until we find some natively supported attributes. Would we implement the implicit converters then this would be totally asymmetrical. So this is probably even a very bad idea.
> support 'implicit converters' for certain types
> -----------------------------------------------
>
> Key: JOHNZON-162
> URL: https://issues.apache.org/jira/browse/JOHNZON-162
> Project: Johnzon
> Issue Type: Bug
> Components: JSON-B, Mapper
> Affects Versions: 1.1.7
> Reporter: Mark Struberg
> Assignee: Mark Struberg
> Priority: Major
>
> We've got a great pull request via github [https://github.com/apache/johnzon/pull/15]
> While the patch is fine I want to still stretch out and implement a feature we similarly added to the ConfigJSR:
> [https://github.com/eclipse/ConfigJSR/blob/master/api/src/main/java/javax/config/spi/Converter.java#L59]
> {quote}
> If no explicit Converter and no built-in Converter could be found for a certain type,
> the \{@code Config} provides an <em>Implicit Converter</em>, if
> * The target type \{@code T} has a Constructor with a String parameter, or
> * The target type \{@code T} has a Constructor with a CharSequence parameter, or
> * the target type \{@code T} has a \{@code static T valueOf(String)} method, or
> * the target type \{@code T} has a \{@code static T valueOf(CharSequence)} method, or
> * the target type \{@code T} has a \{@code static T parse(String)} method, or
> * the target type \{@code T} has a \{@code static T parse(CharSequence)} method
> {quote}
> Since all the java8 time types DO implement one of those signatures we don't need anything more.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)