Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce constants for context params #292

Open
stokito opened this issue Feb 17, 2019 · 1 comment
Open

Introduce constants for context params #292

stokito opened this issue Feb 17, 2019 · 1 comment
Milestone

Comments

@stokito
Copy link
Member

stokito commented Feb 17, 2019

Across the all code it's a common practice to use Map-like contexts. Usually the contexts are used to store some param via .set(paramName, paramValue) method. For example:

  AmountFormatQueryBuilder.of(Locale.GERMANY)
    .set(AmountFormatParams.PATTERN, "####,####")
    .build()

Here we called .set(AmountFormatParams.PATTERN, "####,####") and the PATTERN constant is just a string "pattern". But sometimes instead of constant it's used a raw string i.e. .set("pattern", "####,####"). It will be little bit better to use constants: we can document them and easily find all usages and avoid typos.
You try to search all callings of .set(" in code base and here is short list of my findings:

  • AmountFormatQueryBuilder
    • strict, omitNegative, omitNegativeSign: they are mentioned in userguide.adoc but not used anywhere in sources.
  • RoundingQueryBuilder
    • cashRounding, scale, minimalMinors: are used in code as a raw string but for all of them there is a constants inside of org.javamoney.moneta.internal.DefaultCashRounding but the constants are private. Maybe we can make them public?
  • MonetaryContextBuilder
    • MonetaryRounding
  • ProviderContextBuilder
    • providerDescription, days
@acelopezco
Copy link

I suppose this should be moved to the issues page of jsr354-api project ?

@keilw keilw added this to the .Next milestone Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants