We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28e3667 commit 7a73f21Copy full SHA for 7a73f21
1 file changed
NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/vo/DiscountType.java
@@ -5,7 +5,7 @@ public enum DiscountType {
5
6
PERCENT;
7
8
- public static DiscountType parseString(final String discountType) {
+ public static DiscountType parseValue(final String discountType) {
9
if (discountType != null) {
10
for (final DiscountType type : DiscountType.values()) {
11
if (discountType.equalsIgnoreCase(type.name())) {
@@ -15,4 +15,12 @@ public static DiscountType parseString(final String discountType) {
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