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

Replace Integer/Double by BigInteger/BigDecimal in metadata #87

Open
desruisseaux opened this issue Jul 18, 2023 · 1 comment
Open

Replace Integer/Double by BigInteger/BigDecimal in metadata #87

desruisseaux opened this issue Jul 18, 2023 · 1 comment
Labels
Java Specific to the Java language.

Comments

@desruisseaux
Copy link
Contributor

The ISO 19115-1 standard defines each attribute as optional, mandatory or conditional. The GeoAPI interfaces in the org.opengis.metadata packages reflects the ISO specification by allowing values to be null. Since Java primitive types such as int or double cannot be null, GeoAPI workarounds this limitation by using their wrapper classes instead, which are java.lang.Integer and java.lang.Double respectively. But those numeric values could have been made more flexible by using BigInteger and BigDecimal instead. It would avoid limitations in the magnitude of the number and in precision. It would also allows floating point values to better capture the precision intended by the data producer, which is usually in base 10 with a fixed number of fraction digits (that number can be specified to BigDecimal).. BigInteger and BigDecimal are the types used by default by some tools that generate Java code from XML schemas.

This proposal to replace java.lang.Integer and java.lang.Double by java.math.BigInteger and java.math.BigDecimal is for metadata only, because performance is usually not an issue in metadata (contrarily to referencing, features or coverages) and wrapper classes were already used in metadata anyway (we are not proposing to replace primitive type usages).

@desruisseaux desruisseaux added the Java Specific to the Java language. label Jul 18, 2023
@desruisseaux
Copy link
Contributor Author

Duplicates #46. A possible compromise may be BigInteger for counts, Quantity<?> for real numbers with units of measurement, Number for the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Specific to the Java language.
Projects
None yet
Development

No branches or pull requests

1 participant