Skip to content

Instantly share code, notes, and snippets.

@fedotxxl
Last active August 29, 2015 14:19
Show Gist options
  • Save fedotxxl/2ada07f9ad48671c0eb0 to your computer and use it in GitHub Desktop.
Save fedotxxl/2ada07f9ad48671c0eb0 to your computer and use it in GitHub Desktop.
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExceptionStatus {
OPENED("open"), FIXED("fixed"), IGNORE("ignore"), LATER("later");
private String id;
ExceptionStatus(String id) {
this.id = id;
}
@JsonValue
public String getId() {
return id;
}
@JsonCreator
static ExceptionStatus myValueOf(String id) {
for (ExceptionStatus status : values()) {
if (status.id.equals(id)) return status;
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment