private static DocumentId parse(String serialized) {
        int i, j = -1;
        if ((j = serialized.indexOf(':', i = j + 1)) < i) return null;
        if ( ! "id".equals(serialized.substring(i, j))) return null;
        if ((j = serialized.indexOf(':', i = j + 1)) <= i) return null;
        String namespace = serialized.substring(i, j);
        if ((j = serialized.indexOf(':', i = j + 1)) <= i) return null;
        String documentType = serialized.substring(i, j);
        if ((j = serialized.indexOf(':', i = j + 1)) < i) return null;
        String group = serialized.substring(i, j);
        if (serialized.length() <= (i = j + 1)) return null;
        String userSpecific = serialized.substring(i);
        if (group.startsWith("n=") && group.length() > 2)
            return DocumentId.of(namespace, documentType, Long.parseLong(group.substring(2)), userSpecific);
        if (group.startsWith("g=") && group.length() > 2)
            return DocumentId.of(namespace, documentType, group.substring(2), userSpecific);
        if (group.isEmpty())
            return DocumentId.of(namespace, documentType, userSpecific);
        return null;
    }
Represents a Vespa document id

@author jonmv
vespa-feed-client-api/src/main/java/ai/vespa/feed/client/DocumentId.java