- All Implemented Interfaces:
Serializable
,Comparable<Category>
,Constable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCategory for restaurant-related invoices.Category for supermarket-related invoices. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the refund amount for this category.static void
setCustomRefundAmount
(Category category, double amount) Sets a custom refund amount for a specific category.static Category
Returns the enum constant of this class with the specified name.static Category[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RESTAURANT
Category for restaurant-related invoices. -
SUPERMARKET
Category for supermarket-related invoices.
-
-
Field Details
-
customRefundAmount
public double customRefundAmount
-
-
Method Details
-
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
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 nameNullPointerException
- 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
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.
-