public static boolean isValidNamespace(CharSequence namespace) {
        if (namespace == null) {
            return false;
        } else if (namespace.equals(Prelude.NAMESPACE)) {
            // Shortcut for prelude namespaces.
            return true;
        }

        int length = namespace.length();
        if (length == 0) {
            return false;
        }

        int position = 0;
        while (true) {
            position = parseIdentifier(namespace, position);
            if (position == -1) { // Bad: did not parse a valid identifier.
                return false;
            } else if (position == length) { // Good: parsed and reached the end.
                return true;
            } else if (namespace.charAt(position) != '.') { // Bad: invalid character.
                return false;
            } else if (++position >= length) { // Bad: trailing '.'
                return false;
            } // continue parsing after '.', expecting an identifier.
        }
    }
Checks if the given string is a valid namespace.

@param namespace Namespace value to check.
@return Returns true if this is a valid namespace.
smithy-model/src/main/java/software/amazon/smithy/model/shapes/ShapeId.java