@Test public void applyAddsDescriptionToJavadoc() throws JClassAlreadyExistsException { JDefinedClass jclass = new JCodeModel()._class(TARGET_CLASS_NAME); ObjectMapper mapper = new ObjectMapper(); TextNode descriptionNode = mapper.createObjectNode().textNode("some description"); JDocComment result = rule.apply("fooBar", descriptionNode, null, jclass, null); assertThat(result, sameInstance(jclass.javadoc())); assertThat(result.size(), is(1)); assertThat((String) result.get(0), is("some description")); }
@Override public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { JDocComment javadoc = generatableType.javadoc(); String descriptionText = node.asText(); if(StringUtils.isNotBlank(descriptionText)) { String[] lines = node.asText().split("/\r?\n/"); for(String line : lines) { javadoc.append(line); } } return javadoc; }
DescriptionRule implements Rule<JDocCommentable, JDocComment> { @Override public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { JDocComment javadoc = generatableType.javadoc(); String descriptionText = node.asText(); if(StringUtils.isNotBlank(descriptionText)) { String[] lines = node.asText().split("/\r?\n/"); for(String line : lines) { javadoc.append(line); } } return javadoc; } }
DescriptionRule implements Rule<JDocCommentable, JDocComment> { @Override public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { JDocComment javadoc = generatableType.javadoc(); String descriptionText = node.asText(); if(StringUtils.isNotBlank(descriptionText)) { String[] lines = node.asText().split("/\r?\n/"); for(String line : lines) { javadoc.append(line); } } return javadoc; } protected  DescriptionRule(); }
DescriptionRule implements Rule<JDocCommentable, JDocComment> { @Override public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { JDocComment javadoc = generatableType.javadoc(); String descriptionText = node.asText(); if(StringUtils.isNotBlank(descriptionText)) { String[] lines = node.asText().split("/\r?\n/"); for(String line : lines) { javadoc.append(line); } } return javadoc; } protected  DescriptionRule(); @Override JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema); }
DescriptionRule implements Rule<JDocCommentable, JDocComment> { @Override public JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { JDocComment javadoc = generatableType.javadoc(); String descriptionText = node.asText(); if(StringUtils.isNotBlank(descriptionText)) { String[] lines = node.asText().split("/\r?\n/"); for(String line : lines) { javadoc.append(line); } } return javadoc; } protected  DescriptionRule(); @Override JDocComment apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema);  }