Enum Class DiscountType
- All Implemented Interfaces:
Serializable,Comparable<DiscountType>,Constable
다양한 할인 유형을 정의하는 열거형(enum) 클래스
각 할인 유형은 가격에 따라 다른 할인 정책을 적용합니다.
할인 유형:
할인이 적용되는 함수인 discountPrice는
DiscountStructure를 구현했습니다.
각 할인 유형별로 다른 할인 방식이 적용되도록 람다식을 활용했습니다.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdiscountPrice(int price) static DiscountTypeReturns the enum constant of this class with the specified name.static DiscountType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
Coupon
-
Cash
-
General
-
-
Field Details
-
discountStructure
-
-
Constructor Details
-
DiscountType
-
-
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
-
discountPrice
public int discountPrice(int price)
-