Configure Numbers
Additional info about Gucci's unique number configurations
Last updated
Was this helpful?
Additional info about Gucci's unique number configurations
Last updated
Was this helpful?
As part of our commitment to allowing its customers to create the most unique experience possible with our plugins, we needed to create a custom solution to a common issue we had with configuring numbers while trying to create clean & maintainable code. For those who aren't Java developers, here's a quick rundown...
Numbers in Java come in a range of flavors. The most common being Integer
which covers any positive, or negative number between 0 & (4 bytes of memory). Integers also only cover whole numbers. This leads to the second most common, Double
which can store any positive or negative, decimal or whole number between 0 & 1.79^308
The issue with this is that when you serialize (save) a number of a specific type to a standard format like a config file, it can lose its precision and also can cause a headache for the customer as you have no idea the bounds of the value you are editing. Gucci solves this by saving all number config values in a format that includes a short suffix identifying the runtime type & allows users to know the bounds of the value they are editing.
Configs serialize (save to file) in a format that translates any number into an easy-to-define format.
example: "0.01"
Double (no suffix)
example: "0.01F"
Float (F
suffix)
example: "1"
Integer (no suffix, no .
)
example: "1L"
Long (L
suffix)
example: "1S"
Short (S
suffix)
example: "1B"
Byte (B
suffix)
This does not mean you can change the data types as you wish. The type defined in the default config must be the same as it is when it is created.