class ReferencePlaceholder {

    public static Optional<ReferencePlaceholder> fromCharSequence(@Nullable final CharSequence input) {

        if (input == null) {
            return Optional.empty();
        }

        final Matcher matcher = referencePlaceholderPattern.matcher(input);
        if (matcher.find()) {
            final ReferencedEntityType referencedEntityType = ReferencedEntityType.fromString(matcher.group(1));
            final EntityId entityId = DefaultEntityId.of(matcher.group(2));
            final JsonPointer referencedField = JsonPointer.of(matcher.group(3));
            return Optional.of(new ReferencePlaceholder(referencedEntityType, entityId, referencedField));
        }

        return Optional.empty();
    }

    private  ReferencePlaceholder(final ReferencedEntityType referencedEntityType, final EntityId referencedEntityId,
            final JsonPointer referencedField);

}