Skip to content

Immutable non-parametrized interface? #26

@benjwarner

Description

@benjwarner

Hiya Marco :-)

We've been using Decimal4j, works great 👍

Was wondering if it would be worth creating a non-parametrized immutable interface.

We've adopted the pattern (rightly or wrongly) of declaring our model objects using an mutable-extends-immutable approach, e.g.:

                           +--------------------+
                           |      Order         |
                           +--------------------+
                           | - getPrice():      |
                           |   Decimal<Scale8f> |
                           +--------------------+
                                    ^
                                    |
                                    |
                     +------------------------------+
                     |   MutableOrder               |
                     +------------------------------+
                     | - setPrice(Decimal<Scale8f>) |
                     | - setPrice(long unscaled8f)  |
                     +------------------------------+
                                    ^
                                    |
                                    |
                     +------------------------------+
                     |     OrderImpl                |
                     +------------------------------+
                     | Implements:                  |
                     | - getPrice()                 |
                     | - setPrice(Decimal<Scale8f>) |
                     | - setPrice(long unscaled8f)  |
                     +------------------------------+

Would be nice if there was an ImmutableDecimal8f or similar non-generics interface? Would be nice if we could use the name Decimal8f, but have noticed that is already used as a class.

Keen to know your thoughts. Lemme know if you think I should just suck it up and use Decimal<Scale8f> :-)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions