Module Lunchify
Package jku.se

Enum Class Category

All Implemented Interfaces:
Serializable, Comparable<Category>, Constable

public enum Category extends Enum<Category>
Enum representing the type of invoice category. Each category has a display name and a configurable custom refund amount. If no custom refund amount is set, a default value is used.
  • Enum Constant Details

    • RESTAURANT

      public static final Category RESTAURANT
      Category for restaurant-related invoices.
    • SUPERMARKET

      public static final Category SUPERMARKET
      Category for supermarket-related invoices.
  • Field Details

    • customRefundAmount

      public double customRefundAmount
  • Method Details

    • values

      public static Category[] 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 Category 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
    • getRefundAmount

      public double getRefundAmount()
      Returns the refund amount for this category. If a custom refund amount is set (≥ 0), it is returned; otherwise, the default value is returned.
      Returns:
      Refund amount in euros.
    • setCustomRefundAmount

      public static void setCustomRefundAmount(Category category, double amount)
      Sets a custom refund amount for a specific category.
      Parameters:
      category - The category to update.
      amount - The custom refund amount (must be ≥ 0).
      Throws:
      IllegalArgumentException - if the amount is negative.