Search in sources :

Example 6 with JDocComment

use of com.sun.codemodel.JDocComment in project jsonschema2pojo by joelittlejohn.

the class JavaNameRule method apply.

@Override
public JDocComment apply(String nodeName, JsonNode node, JDocCommentable generatableType, Schema currentSchema) {
    JDocComment javaDoc = generatableType.javadoc();
    javaDoc.append(String.format("%nCorresponds to the \"%s\" property.", nodeName));
    return javaDoc;
}
Also used : JDocComment(com.sun.codemodel.JDocComment)

Example 7 with JDocComment

use of com.sun.codemodel.JDocComment in project jsonschema2pojo by joelittlejohn.

the class DescriptionRule method apply.

/**
     * Applies this schema rule to take the required code generation steps.
     * <p>
     * When a description node is found and applied with this rule, the value of
     * the description is added as a class level JavaDoc comment.
     *
     * @param nodeName
     *            the name of the object to which this description applies
     * @param node
     *            the "description" schema node
     * @param generatableType
     *            comment-able code generation construct, usually a java class,
     *            which should have this description applied
     * @return the JavaDoc comment created to contain the description
     */
@Override
public JDocComment apply(String nodeName, JsonNode node, JDocCommentable generatableType, Schema schema) {
    JDocComment javadoc = generatableType.javadoc();
    javadoc.append(node.asText());
    return javadoc;
}
Also used : JDocComment(com.sun.codemodel.JDocComment)

Aggregations

JDocComment (com.sun.codemodel.JDocComment)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 JCodeModel (com.sun.codemodel.JCodeModel)3 JDefinedClass (com.sun.codemodel.JDefinedClass)3 Test (org.junit.Test)3 TextNode (com.fasterxml.jackson.databind.node.TextNode)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 Schema (org.jsonschema2pojo.Schema)1