We have a situation at the moment with our code where we are using Enums in our Java layer which store an id and a 'display value' with a constructor like below:
public enum Status implements EnumIdentity {
Active(1, "Active"),
AwaitingReview(2, "Awaiting Review"),
Closed(3, "Closed"),
Complete(4, "Complete"),
Draft(5, "Draft"),
InProcess(6, "In Process"),
InReview(7, "In Review"),
NotStarted(8, "Not Started"),
PendingResolution(9, "Pending Resolution"),
Rejected(10, "Rejected");
private int id;
private String displayValue;
PlanStatus(final int id, String displayValue) {
this.id = id;
this.displayValue = displayValue;
}
/** {@inheritDoc} */
@Override
public int id() {
return id;
}
public String getDisplayValue() {
return displayValue;
}
}
and we would like something in typescript to match this to allow for displaying the status in a meaningful way for carrying out logic and for display the value to the user on the front end. Is this possible? Is there a better way to handle this? We would like to avoid having to use logic such as does status.id() = 1 or status.name() = 'Active' hence for the push towards enums.
Thanks