[ 
https://issues.apache.org/jira/browse/LABS-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755428#action_12755428
 ] 

Simone Gianni commented on LABS-378:
------------------------------------

Problem here is that there are many parties involved :
- The converter tells how many chars it could eventually support, depending on 
data type solely
- The validators tells how many chars they will probably be, depending on 
explicit length
- Formatters tells how many chars will be needed depending on format

The three does not talk to each other, but each modifies the length in 
PropertyInfo, not in any specific order. PropertyInfo coordinates by simply 
taking the lower one.

So considering the example of @Range(max=2000) on a double formatted as 
currency :
- The converter returns 20 as the maximum length of a double, cause it does not 
know that it's limited to 2000, and even if known it could have a high number 
of decimals
- The validator returns 4, cause it does know that it's a double, and even if 
known it would return 20 cause it could have decimals
- The formatter returns 20, cause it knows that only 2 decimals are possible, 
but does not know that it's limited to 2000

In this specific case, the formatter should be able to declare a "delta" on the 
length, something like "+3, cause it has a point followed by two decimals". But 
would this be a solution for this specific case only?



> [conversion] When a double field has both a format currency and a range 
> limit, incorrect length is used on text field.
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: LABS-378
>                 URL: https://issues.apache.org/jira/browse/LABS-378
>             Project: Labs
>          Issue Type: Bug
>          Components: Magma
>    Affects Versions: Current
>            Reporter: Simone Gianni
>             Fix For: Current
>
>
> @Format("currency-EUR")
> @Range(max=2000)
> public double getPrice() { ... }
> Will produce a field having maxsize="4", able to accomodate "1000" but not 
> "1000.01"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: labs-unsubscr...@labs.apache.org
For additional commands, e-mail: labs-h...@labs.apache.org

Reply via email to