@SuppressWarnings({"unchecked", "deprecation"})
    protected static <T extends AzureExpandableStringEnum<T>> T fromString(String name, Class<T> clazz) {
        if (name == null) {
            return null;
        }

        ConcurrentHashMap<String, ?> clazzValues = VALUES.computeIfAbsent(clazz, key -> new ConcurrentHashMap<>());
        T value = (T) clazzValues.get(name);

        if (value != null) {
            return value;
        } else {
            MethodHandle ctor = CONSTRUCTORS.computeIfAbsent(clazz, AzureExpandableStringEnum::getDefaultConstructor);

            if (ctor == null) {
                // logged in ExpandableStringEnum::getDefaultConstructor
                return null;
            }

            try {
                value = (T) ctor.invoke();
            } catch (Throwable e) {
                LOGGER.warn("Failed to create {}, default constructor threw exception", clazz.getName(), e);
                return null;
            }

            return value.nameAndAddValue(name, value, clazz);
        }
    }
Creates an instance of the specific expandable string enum from a String.

@param name The value to create the instance from.
@param clazz The class of the expandable string enum.
@param <T> the class of the expandable string enum.
@return The expandable string enum instance.

@throws RuntimeException wrapping implementation class constructor exception (if any is thrown).
chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/azure/model/AzureExpandableStringEnum.java