Enum Class Moneda

java.lang.Object
java.lang.Enum<Moneda>
cl.conversor.moneda.Moneda
All Implemented Interfaces:
Serializable, Comparable<Moneda>, Constable

public enum Moneda extends Enum<Moneda>
Moneda currency representation `NAME (symbol, rate)`
  • Enum Constant Details

    • USD

      public static final Moneda USD
    • CLP

      public static final Moneda CLP
    • EUR

      public static final Moneda EUR
    • GBP

      public static final Moneda GBP
    • JPY

      public static final Moneda JPY
    • KRW

      public static final Moneda KRW
  • Method Details

    • values

      public static Moneda[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Moneda valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • symbol

      public final String symbol()
      Returns:
      Currency symbol
    • rate

      public final BigDecimal rate()
      Returns:
      Currency rate
    • getBase

      public final BigDecimal getBase(BigDecimal monto)
      Converts to base currency (USD) at self.rate
      Parameters:
      monto - amount to convert to base currency
      Returns:
      BigDecimal base value
    • convert

      public final Double convert(Moneda destino, Double monto)
      Converts `monto` to `destino` currency
      Parameters:
      destino - target conversion Currency
      monto - amount
      Returns:
      Double conversion
    • esMoneda

      public static final boolean esMoneda(String value)
      Check if `value` is part of enum Moneda
      Parameters:
      value - String currency
      Returns:
      true if value is an enum Moneda, otherwise returns false
    • monedaString

      public static final String monedaString(Double monto)
      Returns String representation of Double `monto`
      Parameters:
      monto - Double amount for String representation
      Returns:
      String representation of `monto`