class ImmutableSubjectId implements SubjectId {

    public static SubjectId of(final SubjectIssuer issuer, final CharSequence subject) {
        checkNotNull(issuer, "issuer");
        argumentNotEmpty(subject, "subject");

        final String subjectIdAsString = issuer.toString() + ":" + subject.toString();
        final Validator validator = NoControlCharactersValidator.getInstance(subjectIdAsString);
        if (!validator.isValid()) {
            throw SubjectIdInvalidException.newBuilder(subjectIdAsString)
                    .description(validator.getReason().orElse(null))
                    .build();
        }

        return new ImmutableSubjectId(issuer, subject.toString());
    }

    private  ImmutableSubjectId(final SubjectIssuer issuer, final String subject);

}