class DocumentationResourceImpl implements DocumentationResource {

    String selectById(final String name, final String value, final DocumentationSegment segment) {
        final List<String> lines;
        try (final BufferedReader reader = new BufferedReader(new StringReader(value))) {
            lines = reader.lines().collect(toList());
        } catch (final IOException e) {
            throw new IllegalArgumentException(e);
        }

        return extractUsingComments(name, lines, segment)
                .orElseGet(() -> noMarkingCommentFallbackExtraction(name, lines, segment, value));
    }

}