File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/vo Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ public enum DiscountType {
55
66 PERCENT ;
77
8- public static DiscountType parseString (final String discountType ) {
8+ public static DiscountType parseValue (final String discountType ) {
99 if (discountType != null ) {
1010 for (final DiscountType type : DiscountType .values ()) {
1111 if (discountType .equalsIgnoreCase (type .name ())) {
@@ -15,4 +15,12 @@ public static DiscountType parseString(final String discountType) {
1515 }
1616 throw new IllegalArgumentException (discountType );
1717 }
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+ }
1826}
You can’t perform that action at this time.
0 commit comments