Skip to content

Instantly share code, notes, and snippets.

@mressler
Last active January 30, 2019 19:30
Show Gist options
  • Save mressler/e02bbc5279966f13671e5571dd1c91db to your computer and use it in GitHub Desktop.
Save mressler/e02bbc5279966f13671e5571dd1c91db to your computer and use it in GitHub Desktop.
sessionTypeUuid Disambiguation
package com.diamondkinetics.model.enums;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.diamondkinetics.model.json.SessionTypeSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(using = SessionTypeSerializer.class)
public enum SessionType {
TEE("500126d4-129d-4c4e-9331-7b447da48dab", "Tee", 0, false),
FRONT_TOSS("0a28c29f-5375-49ee-8022-e0e0f04f09fa", "Soft Toss - Front", 1, false),
SOFT_TOSS("64995072-0cfd-406d-af06-d855508c3194", "Soft Toss - Side", 2, false),
PITCHING_MACHINE("c25d50f3-83ee-4662-8d67-e8240d3ebc5b", "Pitching Machine", 3, true),
BATTING_PRACTICE("05d9b19e-1f01-4369-b3e9-7d55f7c56c4a", "Batting Practice", 4, false),
LIVE_PITCH_LEFTY("ad24bbb8-04fe-4cbc-890f-fb1476dc8ec9", "Live Pitch - Lefthander", 5, true),
LIVE_PITCH_RIGHTY("8c72931b-eab3-457a-91a5-4bf2e7ef2b1c", "Live Pitch - Righthander", 6, true);
private static final Logger logger = LoggerFactory.getLogger(SessionType.class);
private String uuid;
private String name;
private Integer sortOrder;
private boolean usePitchType;
private SessionType(String uuid, String name, Integer sortOrder, boolean usePitchType) {
this.uuid = uuid;
this.name = name;
this.sortOrder = sortOrder;
this.usePitchType = usePitchType;
}
public String getUuid() {
return uuid;
}
public String getName() {
return name;
}
public Integer getSortOrder() {
return sortOrder;
}
public boolean getUsePitchType() {
return usePitchType;
}
public static SessionType getByUuid(String someUuid) {
if (someUuid != null) {
for (SessionType s : SessionType.values()) {
if (someUuid.equals(s.getUuid())) {
return s;
}
}
logger.warn("Unknown SessionType: " + someUuid);
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment