MCPcopy
hub / github.com/baidu/uid-generator / parse

Method parse

src/main/java/com/baidu/fsg/uid/utils/EnumUtils.java:34–46  ·  view source on GitHub ↗

Parse the bounded value into ValuedEnum @param clz @param value @return

(Class<T> clz, V value)

Source from the content-addressed store, hash-verified

32 * @return
33 */
34 public static <T extends ValuedEnum<V>, V> T parse(Class<T> clz, V value) {
35 Assert.notNull(clz, "clz can not be null");
36 if (value == null) {
37 return null;
38 }
39
40 for (T t : clz.getEnumConstants()) {
41 if (value.equals(t.value())) {
42 return t;
43 }
44 }
45 return null;
46 }
47
48 /**
49 * Null-safe valueOf function

Callers

nothing calls this directly

Calls 1

valueMethod · 0.65

Tested by

no test coverage detected