Skip to content

Commit

Permalink
Fix broken deserial
Browse files Browse the repository at this point in the history
  • Loading branch information
loicgreffier committed Mar 23, 2024
1 parent 06b43a1 commit 9c3027c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/java/com/michelin/kafkactl/model/Status.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.michelin.kafkactl.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import io.micronaut.core.annotation.ReflectiveAccess;
import java.util.List;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -31,7 +32,24 @@ public class Status {
*/
public enum StatusPhase {
SUCCESS,
FAILED
FAILED;

/**
* Build status phase from string.
* This is because Ns4Kafka returns capitalised status phases.
*
* @param key the key
* @return the status phase
*/
@JsonCreator
public static StatusPhase fromString(String key) {
for (StatusPhase type : StatusPhase.values()) {
if (type.name().equalsIgnoreCase(key)) {
return type;
}
}
return null;
}
}

/**
Expand Down

0 comments on commit 9c3027c

Please sign in to comment.