public Comment toComment() { return new Comment(value, line); }
@Override public void comment(String comment, Integer line) { stash.comment(new Comment(comment, line)); }
private List<Comment> comments(Map o) { List<Comment> comments = new ArrayList<Comment>(); if (o.containsKey("comments")) { for (Object e : ((List) o.get("comments"))) { Map map = (Map) e; comments.add(new Comment(getString(map, "value"), getInt(map, "line"))); } } return comments; }
List<String> values = data.getValues().get(lineNumInResource); String valueComment = String.format("# %s:%d", filePathFromComment, lineNumInResource + 1); Comment comment = new Comment(valueComment, lineNumInResource); List<Comment> comments = Lists.newArrayList(comment); int newLineNum = tableRowHeader.getLine() + lineNumOffset;
private Step loadAndReplaceSteps(Step step, String filePathFromComment, Resource sourceResource) { DataReader dataReader; try { InputStream inputStream = sourceResource.getInputStream(); dataReader = DataReaderFactory.create(sourceResource.getFilename()); DataDTO data = dataReader.readTable(inputStream); List<DataTableRow> rows = Lists.newArrayList(); for (Integer lineNum : data.getValues().keySet()) { List<String> cells = Lists.newArrayList(data.getValues().get(lineNum)); String valueComment = String.format("# %s:%d", filePathFromComment, lineNum + 1); Comment comment = new Comment(valueComment, lineNum); List<Comment> comments = Lists.newArrayList(comment); int newLineNum = step.getLine() + 2; if (isPreview) { newLineNum += lineOffset; } DataTableRow row = new DataTableRow(comments, cells, newLineNum + 1); rows.add(row); lineOffset += 2; } // re-calculate lineOffset lineOffset = lineOffset - step.getRows().size() - 1; step = new Step(step.getComments(), step.getKeyword(), step.getName(), step.getLine(), rows, step.getDocString()); } catch (InstantiationException | IllegalAccessException | IOException e) { throw Throwables.propagate(e); } return step; }