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

Add configurable factory API to create Decimal32/64/128 instead of having to rely on static methods on individual types #6

Open
mrotteveel opened this issue Oct 1, 2024 · 0 comments
Assignees

Comments

@mrotteveel
Copy link
Member

Add configurable factory API to create Decimal32/64/128 instead of having to rely on static methods on individual types.

Currently, when you want to create a decimal, you need to call the right static method on the specific class you want to create, and if you want different overflow handling, you need to call yet another method. Having a configurable factory can simplify code where depending on some external input, conditions or configuration, different types need to be produced.

It would be helpful to be able to configure a factory/builder with the desired type and overflow handling, which would produce the right type from byte[], BigDecimal or BigInteger (valueOf and valueOfExact equivalents). This should be separate from the DecimalFactory interface used internally.

Beyond its configuration, this factory should be stateless and thread-safe.

@mrotteveel mrotteveel self-assigned this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant