We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2141fad commit 12a9538Copy full SHA for 12a9538
1 file changed
NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/vo/DiscountType.java
@@ -0,0 +1,26 @@
1
+package com.labs64.netlicensing.domain.vo;
2
+
3
+public enum DiscountType {
4
+ FIX,
5
6
+ PERCENT;
7
8
+ public static DiscountType parseValue(final String discountType) {
9
+ if (discountType != null) {
10
+ for (final DiscountType type : DiscountType.values()) {
11
+ if (discountType.equalsIgnoreCase(type.name())) {
12
+ return type;
13
+ }
14
15
16
+ throw new IllegalArgumentException(discountType);
17
18
19
+ public static DiscountType parseValueSafe(final String discountType) {
20
+ try {
21
+ return parseValue(discountType);
22
+ } catch (final IllegalArgumentException e) {
23
+ return null;
24
25
26
+}
0 commit comments