Record Class Currency
java.lang.Object
java.lang.Record
fr.mathildeuh.youneedme.api.economy.Currency
public record Currency(String id, String symbol, String singularName, String pluralName, int decimalPlaces)
extends Record
A currency YouNeedMe's economy can hold a balance in. Servers running a single currency (the
default) never need to think about this type at all - every
EconomyService method has an
overload that assumes id() "default".-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedecimalPlacesrecord component.final booleanIndicates whether some other object is "equal to" this one.format(double amount) formatNumber(double amount) Just the grouped, fixed-precision number (no symbol/name) - for templates that place the currency symbol/name separately.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Returns the value of thepluralNamerecord component.Returns the value of thesingularNamerecord component.symbol()Returns the value of thesymbolrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Currency
public Currency(String id, String symbol, String singularName, String pluralName, int decimalPlaces) Creates an instance of aCurrencyrecord class.- Parameters:
id- the value for theidrecord componentsymbol- the value for thesymbolrecord componentsingularName- the value for thesingularNamerecord componentpluralName- the value for thepluralNamerecord componentdecimalPlaces- the value for thedecimalPlacesrecord component
-
-
Method Details
-
format
-
formatNumber
Just the grouped, fixed-precision number (no symbol/name) - for templates that place the currency symbol/name separately. Built withDecimalFormatrather than a printf-style pattern assembled fromdecimalPlacesat runtime, since a pattern string built that way can't be statically verified as well-formed. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
symbol
Returns the value of thesymbolrecord component.- Returns:
- the value of the
symbolrecord component
-
singularName
Returns the value of thesingularNamerecord component.- Returns:
- the value of the
singularNamerecord component
-
pluralName
Returns the value of thepluralNamerecord component.- Returns:
- the value of the
pluralNamerecord component
-
decimalPlaces
public int decimalPlaces()Returns the value of thedecimalPlacesrecord component.- Returns:
- the value of the
decimalPlacesrecord component
-