[jira] [Assigned] (OFBIZ-7593) Enforce noninstantiability to UtilNumber class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Assigned] (OFBIZ-7593) Enforce noninstantiability to UtilNumber class

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-7593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arun Patidar reassigned OFBIZ-7593:
-----------------------------------

    Assignee: Arun Patidar  (was: Anurag Chandak)

> Enforce noninstantiability to UtilNumber class
> ----------------------------------------------
>
>                 Key: OFBIZ-7593
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7593
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Rishi Solanki
>            Assignee: Arun Patidar
>            Priority: Minor
>         Attachments: OFBIZ-7593.patch
>
>
> - Make class as final.
> - Add a private constructor.
> - Make the following public static variables as private and move it to top with static block
> {code}
>     // ICU4J rule sets for the en_US locale. To add more rules, expand this string.
>     // For reference, see the RbnfSampleRuleSets.java file distributed with ICU4J
>     public static final String ruleSet_en_US =
>         /*
>          * These rules format a number in one of the two styles often used
>          * on checks.  %dollars-and-hundredths formats cents as hundredths of
>          * a dollar (23.40 comes out as "twenty-three and 40/100 dollars").
>          * %dollars-and-cents formats in dollars and cents (23.40 comes out as
>          * "twenty-three dollars and forty cents")
>          */
>         "%dollars-and-cents:\n"
>         + "    x.0: << [and >%%cents>];\n"
>         + "    0.x: >%%cents>;\n"
>         + "    0: zero dollars; one dollar; =%%main= dollars;\n"
>         + "%%main:\n"
>         + "    zero; one; two; three; four; five; six; seven; eight; nine;\n"
>         + "    ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n"
>         + "        seventeen; eighteen; nineteen;\n"
>         + "    20: twenty[->>];\n"
>         + "    30: thirty[->>];\n"
>         + "    40: forty[->>];\n"
>         + "    50: fifty[->>];\n"
>         + "    60: sixty[->>];\n"
>         + "    70: seventy[->>];\n"
>         + "    80: eighty[->>];\n"
>         + "    90: ninety[->>];\n"
>         + "    100: << hundred[ >>];\n"
>         + "    1000: << thousand[ >>];\n"
>         + "    1,000,000: << million[ >>];\n"
>         + "    1,000,000,000: << billion[ >>];\n"
>         + "    1,000,000,000,000: << trillion[ >>];\n"
>         + "    1,000,000,000,000,000: =#,##0=;\n"
>         + "%%cents:\n"
>         + "    100: <%%main< cent[s];\n"
>         + "%dollars-and-hundredths:\n"
>         + "    x.0: <%%main< and >%%hundredths>/100;\n" // this used to end in 'dollars' but that should be added later
>         + "%%hundredths:\n"
>         + "    100: <00<;\n";
>     // ICU4J rule sets for the th_TH locale. To add more rules, expand this string.
>     // For reference, see the RbnfSampleRuleSets.java file distributed with ICU4J
>     public static final String ruleSet_th_TH =
>         /*
>          * These rules format a number in one of the two styles often used
>          * on checks.  %bahts-and-hundredths formats stangs as hundredths of
>          * a baht (23.40 comes out as "twenty-three and 40/100 bahts").
>          * %bahts-and-stangs formats in bahts and stangs (23.40 comes out as
>          * "twenty-three bahts and forty stangs")
>          */
>         "%bahts-and-stangs:\n"
>         + "    x.0: << [and >%%stangs>];\n"
>         + "    0.x: >%%stangs>;\n"
>         + "    0: zero bahts; one baht; =%%main= bahts;\n"
>         + "%%main:\n"
>         + "    zero; one; two; three; four; five; six; seven; eight; nine;\n"
>         + "    ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n"
>         + "        seventeen; eighteen; nineteen;\n"
>         + "    20: twenty[->>];\n"
>         + "    30: thirty[->>];\n"
>         + "    40: forty[->>];\n"
>         + "    50: fifty[->>];\n"
>         + "    60: sixty[->>];\n"
>         + "    70: seventy[->>];\n"
>         + "    80: eighty[->>];\n"
>         + "    90: ninety[->>];\n"
>         + "    100: << hundred[ >>];\n"
>         + "    1000: << thousand[ >>];\n"
>         + "    1,000,000: << million[ >>];\n"
>         + "    1,000,000,000: << billion[ >>];\n"
>         + "    1,000,000,000,000: << trillion[ >>];\n"
>         + "    1,000,000,000,000,000: =#,##0=;\n"
>         + "%%stangs:\n"
>         + "    100: <%%main< stang[s];\n"
>         + "%bahts-and-hundredths:\n"
>         + "    x.0: <%%main< and >%%hundredths>/100;\n" // this used to end in 'bahts' but that should be added later
>         + "%%hundredths:\n"
>         + "    100: <00<;\n";
>     // hash map to store ICU4J rule sets keyed to Locale
>     public static HashMap<Locale, String> rbnfRuleSets;
>     static {
>         rbnfRuleSets = new HashMap<Locale, String>();
>         rbnfRuleSets.put(Locale.US, ruleSet_en_US);
>         rbnfRuleSets.put(new Locale("th"), ruleSet_th_TH);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)