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)
| 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 |