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

Method getConstant

code/src/java/pcgen/cdom/enumeration/FactKey.java:75–91  ·  view source on GitHub ↗

Returns the FactKey for the given String (the search for the constant is case-insensitive). If the constant does not already exist, a new FactKey is created with the given String as the name of the FactKey. @param name The name of the FactKey to be returned @return The FactKey for the gi

(String name, FormatManager<T> fmtManager)

Source from the content-addressed store, hash-verified

73 * @return The FactKey for the given name
74 */
75 public static <T> FactKey<T> getConstant(String name, FormatManager<T> fmtManager)
76 {
77 //This cast is checked by the "else" below
78 @SuppressWarnings("unchecked")
79 FactKey<T> key = (FactKey<T>) typeMap.get(name);
80 if (key == null)
81 {
82 key = new FactKey<>(name, fmtManager);
83 typeMap.put(name, key);
84 }
85 else if (!key.formatManager.equals(fmtManager))
86 {
87 throw new IllegalArgumentException(
88 "FactKey: " + name + " does not store objects of " + fmtManager.getManagedClass().getCanonicalName());
89 }
90 return key;
91 }
92
93 /**
94 * Returns the FactKey for the given String (the search for the constant is

Callers 13

testGetPCCTextMethod · 0.95
testGetPCCTextMethod · 0.95
setUpMethod · 0.95
testBasicMethod · 0.95
testDynamicMethod · 0.95
setUpMethod · 0.95
getFactKeyMethod · 0.95
setFactMethod · 0.95
createDomainMethod · 0.95
createChecksMethod · 0.95
testFactKeyActorMethod · 0.95

Calls 4

getMethod · 0.65
putMethod · 0.65
equalsMethod · 0.65
getManagedClassMethod · 0.65

Tested by 12

testGetPCCTextMethod · 0.76
testGetPCCTextMethod · 0.76
setUpMethod · 0.76
testBasicMethod · 0.76
testDynamicMethod · 0.76
setUpMethod · 0.76
setFactMethod · 0.76
createDomainMethod · 0.76
createChecksMethod · 0.76
testFactKeyActorMethod · 0.76