Skip to content

Commit

Permalink
Fix serialization of LineMode for LineChartOp (#3199)
Browse files Browse the repository at this point in the history
Same reason as #3132
  • Loading branch information
bobbai00 authored Jan 14, 2025
1 parent 8ee3570 commit 3f66f4e
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.uci.ics.amber.operator.visualization.lineChart;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum LineMode {
Expand All @@ -12,6 +13,17 @@ public enum LineMode {
this.mode = mode;
}

// Handle custom deserialization for enum
@JsonCreator
public static LineMode fromString(String value) {
for (LineMode mode : LineMode.values()) {
if (mode.mode.equalsIgnoreCase(value)) {
return mode;
}
}
throw new IllegalArgumentException("Unknown line mode: " + value);
}

@JsonValue
public String getMode() {
return mode;
Expand Down

0 comments on commit 3f66f4e

Please sign in to comment.