Search in sources :

Example 6 with JavaDocBuilder

use of com.thoughtworks.qdox.JavaDocBuilder in project jsonschema2pojo by joelittlejohn.

the class RequiredArrayIT method generateClasses.

@BeforeClass
public static void generateClasses() throws ClassNotFoundException, IOException {
    classSchemaRule.generateAndCompile("/schema/required/requiredArray.json", "com.example");
    File generatedJavaFile = classSchemaRule.generated("com/example/RequiredArray.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFile);
    classWithRequired = javaDocBuilder.getClassByName("com.example.RequiredArray");
}
Also used : File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) BeforeClass(org.junit.BeforeClass)

Example 7 with JavaDocBuilder

use of com.thoughtworks.qdox.JavaDocBuilder in project jsonschema2pojo by joelittlejohn.

the class RequiredIT method generateClasses.

@BeforeClass
public static void generateClasses() throws ClassNotFoundException, IOException {
    classSchemaRule.generateAndCompile("/schema/required/required.json", "com.example");
    File generatedJavaFile = classSchemaRule.generated("com/example/Required.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFile);
    classWithRequired = javaDocBuilder.getClassByName("com.example.Required");
}
Also used : File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) BeforeClass(org.junit.BeforeClass)

Example 8 with JavaDocBuilder

use of com.thoughtworks.qdox.JavaDocBuilder in project jsonschema2pojo by joelittlejohn.

the class DescriptionIT method generateClasses.

@BeforeClass
public static void generateClasses() throws ClassNotFoundException, IOException {
    schemaRule.generateAndCompile("/schema/description/description.json", "com.example");
    File generatedJavaFile = schemaRule.generated("com/example/Description.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFile);
    classWithDescription = javaDocBuilder.getClassByName("com.example.Description");
}
Also used : File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) BeforeClass(org.junit.BeforeClass)

Example 9 with JavaDocBuilder

use of com.thoughtworks.qdox.JavaDocBuilder in project jsonschema2pojo by joelittlejohn.

the class JavaNameIT method inlineRequiredAppearsInFieldJavadoc.

@Test
public void inlineRequiredAppearsInFieldJavadoc() throws IOException {
    schemaRule.generateAndCompile("/schema/javaName/javaNameWithRequiredProperties.json", "com.example.required");
    File generatedJavaFileWithRequiredProperties = schemaRule.generated("com/example/required/JavaNameWithRequiredProperties.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFileWithRequiredProperties);
    JavaClass classWithRequiredProperties = javaDocBuilder.getClassByName("com.example.required.JavaNameWithRequiredProperties");
    JavaField javaFieldWithoutJavaName = classWithRequiredProperties.getFieldByName("inlineRequiredPropertyWithoutJavaName");
    JavaField javaFieldWithJavaName = classWithRequiredProperties.getFieldByName("inlineRequiredPropertyWithoutJavaName");
    assertThat(javaFieldWithoutJavaName.getComment(), containsString("(Required)"));
    assertThat(javaFieldWithJavaName.getComment(), containsString("(Required)"));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) JavaClass(com.thoughtworks.qdox.model.JavaClass) File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) Test(org.junit.Test)

Example 10 with JavaDocBuilder

use of com.thoughtworks.qdox.JavaDocBuilder in project jsonschema2pojo by joelittlejohn.

the class JavaNameIT method arrayRequiredAppearsInFieldJavadoc.

@Test
public void arrayRequiredAppearsInFieldJavadoc() throws IOException {
    schemaRule.generateAndCompile("/schema/javaName/javaNameWithRequiredProperties.json", "com.example.required");
    File generatedJavaFileWithRequiredProperties = schemaRule.generated("com/example/required/JavaNameWithRequiredProperties.java");
    JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
    javaDocBuilder.addSource(generatedJavaFileWithRequiredProperties);
    JavaClass classWithRequiredProperties = javaDocBuilder.getClassByName("com.example.required.JavaNameWithRequiredProperties");
    JavaField javaFieldWithoutJavaName = classWithRequiredProperties.getFieldByName("requiredPropertyWithoutJavaName");
    JavaField javaFieldWithJavaName = classWithRequiredProperties.getFieldByName("requiredPropertyWithoutJavaName");
    assertThat(javaFieldWithoutJavaName.getComment(), containsString("(Required)"));
    assertThat(javaFieldWithJavaName.getComment(), containsString("(Required)"));
}
Also used : JavaField(com.thoughtworks.qdox.model.JavaField) JavaClass(com.thoughtworks.qdox.model.JavaClass) File(java.io.File) JavaDocBuilder(com.thoughtworks.qdox.JavaDocBuilder) Test(org.junit.Test)

Aggregations

JavaDocBuilder (com.thoughtworks.qdox.JavaDocBuilder)12 File (java.io.File)9 JavaClass (com.thoughtworks.qdox.model.JavaClass)6 BeforeClass (org.junit.BeforeClass)4 DocletTag (com.thoughtworks.qdox.model.DocletTag)3 JavaField (com.thoughtworks.qdox.model.JavaField)3 JavaMethod (com.thoughtworks.qdox.model.JavaMethod)3 StringReader (java.io.StringReader)3 Test (org.junit.Test)3 AbstractInheritableJavaEntity (com.thoughtworks.qdox.model.AbstractInheritableJavaEntity)2 AbstractJavaEntity (com.thoughtworks.qdox.model.AbstractJavaEntity)2 JavaSource (com.thoughtworks.qdox.model.JavaSource)1 ParseException (com.thoughtworks.qdox.parser.ParseException)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Resource (org.apache.maven.model.Resource)1