MCPcopy Create free account
hub / github.com/PCGen/pcgen / getKeyFor

Method getKeyFor

code/src/java/pcgen/cdom/enumeration/ObjectKey.java:351–373  ·  view source on GitHub ↗
(Class<OT> objectClass, String name)

Source from the content-addressed store, hash-verified

349 }
350
351 public static <OT> ObjectKey<OT> getKeyFor(Class<OT> objectClass, String name)
352 {
353 if (map == null)
354 {
355 buildMap();
356 }
357 /*
358 * CONSIDER This is actually not type safe, there is a case of asking
359 * for a String a second time with a different Class that ObjectKey
360 * currently does not handle. Two solutions: One, store this in a
361 * Two-Key map and allow a String to map to more than one ObjectKey
362 * given different output types (considered confusing) or Two, store the
363 * Class and validate that with a an error message if a different class
364 * is requested.
365 */
366 ObjectKey<OT> key = (ObjectKey<OT>) map.get(name);
367 if (key == null)
368 {
369 key = new ObjectKey<>(null);
370 map.put(name, key);
371 }
372 return key;
373 }
374
375 private static void buildMap()
376 {

Callers 15

parseNonEmptyTokenMethod · 0.95
parseNonEmptyTokenMethod · 0.95
parseNonEmptyTokenMethod · 0.95
getControlTokenMethod · 0.95
isFeatureEnabledMethod · 0.95
hasControlTokenMethod · 0.95
getMethod · 0.95
getControlMethod · 0.95
hasControlMethod · 0.95
isFeatureEnabledMethod · 0.95

Calls 3

buildMapMethod · 0.95
getMethod · 0.65
putMethod · 0.65

Tested by 3

enableFeatureMethod · 0.76