class ImmutableDefinitionIdentifier implements DefinitionIdentifier {

    static DefinitionIdentifier ofParsed(final CharSequence definitionIdentifier) {
        checkNotNull(definitionIdentifier, "CharSequence-representation of the identifier");

        if (definitionIdentifier instanceof DefinitionIdentifier) {
            return (DefinitionIdentifier) definitionIdentifier;
        }

        final Matcher matcher = IDENTIFIER_PATTERN.matcher(definitionIdentifier);
        if (!matcher.matches()) {
            throw new DefinitionIdentifierInvalidException(definitionIdentifier);
        }

        final String parsedNamespace = matcher.group(CapturingGroup.NAMESPACE);
        final String parsedName = matcher.group(CapturingGroup.NAME);
        final String parsedVersion = matcher.group(CapturingGroup.VERSION);

        return getInstance(parsedNamespace, parsedName, parsedVersion);
    }

    private  ImmutableDefinitionIdentifier(final CharSequence theNamespace, final CharSequence theName,
            final CharSequence theVersion);

}