You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by William Lieurance <wi...@namikoda.com> on 2018/02/12 02:11:56 UTC

supportedFormats text consistency

Hi all,

I'm looking at the supportedFormats added by the converters in core.  I note a lot of inconsistency in the text with most converters adding types with <> around them.  For instance the LongConverter adds "<long>" but the ShortConverter adds "short".  The various date and duration converters add examples with no <> in that same spot, and BigDecimal has a type and an arrow and some other information "<bigDecimal> -> new BigDecimal(String)".   Is there a consistent pattern I can throw into tests?  I looked around at the documentation but while the list of supportedFormats is in there, there's not much info about what these strings are supposed to mean to the reader including the difference between a type in <> and one that is not.

--William


https://github.com/apache/incubator-tamaya/blob/master/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LongConverter.java#L53
https://github.com/apache/incubator-tamaya/blob/master/code/core/src/main/java/org/apache/tamaya/core/internal/converters/ShortConverter.java#L54
https://github.com/apache/incubator-tamaya/blob/master/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.java#L51

Re: supportedFormats text consistency

Posted by "P. Ottlinger" <po...@apache.org>.
Hi *,

Am 12.02.2018 um 03:11 schrieb William Lieurance:
> I'm looking at the supportedFormats added by the converters in core.  I note a lot of inconsistency in the text with most converters adding types with <> around them.  For instance the LongConverter adds "<long>" but the ShortConverter adds "short".  The various date and duration converters add examples with no <> in that same spot, and BigDecimal has a type and an arrow and some other information "<bigDecimal> -> new BigDecimal(String)".   Is there a consistent pattern I can throw into tests?  I looked around at the documentation but while the list of supportedFormats is in there, there's not much info about what these strings are supposed to mean to the reader including the difference between a type in <> and one that is not.
> 
> --William
> 
> 
> https://github.com/apache/incubator-tamaya/blob/master/code/core/src/main/java/org/apache/tamaya/core/internal/converters/LongConverter.java#L53
> https://github.com/apache/incubator-tamaya/blob/master/code/core/src/main/java/org/apache/tamaya/core/internal/converters/ShortConverter.java#L54
> https://github.com/apache/incubator-tamaya/blob/master/code/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.java#L51


browsing through the code at
https://github.com/peculater/incubator-tamaya/blob/ca4de3dc49fefa020e89073b8032be7de20ab27d/code/api/src/main/java/org/apache/tamaya/spi/ConversionContext.java#L99

I think we should harmonize the way we register new formats and decide
for one format across all implementations.

To "enforce" this format we could add it to the Javadoc.

Having a look at the way the format is added I'd recommend to replace

supportedFormats.add(format + " (" + converterType.getSimpleName() + ")");

with

supportedFormats.add(format + " (" + converterType.getSimpleName() +
".class)");

which would make it easier to just remove the <...> among implementations.

Just my 2ct

Phil