/** * Attempts to lookup a defined top-level type using the given type name. * Note, per RFC-6838 4.2, top-level type and subtype names are case-insensitive. * * @param typeName * the name to lookup a Type instance by. * * @return The top-level Type instance identified by the given type name, if one is not found, then a new Type * instance is created with the given name. */ public static Type of(final String typeName) { // return a top-level type instance if givenType's name matches, else create a new type final Type type = lowercaseNameToTypeValuesMap.get(typeName.toLowerCase()); return type != null ? type : new Type(typeName); // allow non-registered top-level types. }