Search in sources :

Example 1 with DescriptionFile

use of io.strimzi.crdgenerator.annotations.DescriptionFile in project strimzi by strimzi.

the class DocGenerator method appendDescription.

private void appendDescription(Class<?> cls) throws IOException {
    DescriptionFile descriptionFile = cls.getAnnotation(DescriptionFile.class);
    Description description = cls.getAnnotation(Description.class);
    if (descriptionFile != null) {
        String filename = "api/" + cls.getCanonicalName() + ".adoc";
        File includeFile = new File(filename);
        if (!includeFile.isFile()) {
            throw new RuntimeException("Class " + cls.getCanonicalName() + " has @DescribeFile annotation, but file " + filename + " does not exist!");
        }
        out.append("xref:type-").append(cls.getSimpleName()).append("-schema-{context}[Full list of `").append(cls.getSimpleName()).append("` schema properties]").append(NL);
        out.append(NL);
        out.append("include::../" + filename + "[leveloffset=+1]").append(NL);
        out.append(NL);
        out.append("[id='type-").append(cls.getSimpleName()).append("-schema-{context}']").append(NL);
        out.append("==== `").append(cls.getSimpleName()).append("` schema properties").append(NL);
        out.append(NL);
    } else if (description != null) {
        out.append(getDescription(description)).append(NL);
    }
    out.append(NL);
}
Also used : Description(io.strimzi.crdgenerator.annotations.Description) DescriptionFile(io.strimzi.crdgenerator.annotations.DescriptionFile) DescriptionFile(io.strimzi.crdgenerator.annotations.DescriptionFile) File(java.io.File)

Example 2 with DescriptionFile

use of io.strimzi.crdgenerator.annotations.DescriptionFile in project strimzi-kafka-operator by strimzi.

the class DocGenerator method appendDescription.

private void appendDescription(Class<?> cls) throws IOException {
    DescriptionFile descriptionFile = cls.getAnnotation(DescriptionFile.class);
    Description description = cls.getAnnotation(Description.class);
    if (descriptionFile != null) {
        String filename = "api/" + cls.getCanonicalName() + ".adoc";
        File includeFile = new File(filename);
        if (!includeFile.isFile()) {
            throw new RuntimeException("Class " + cls.getCanonicalName() + " has @DescribeFile annotation, but file " + filename + " does not exist!");
        }
        out.append("xref:type-").append(cls.getSimpleName()).append("-schema-{context}[Full list of `").append(cls.getSimpleName()).append("` schema properties]").append(NL);
        out.append(NL);
        out.append("include::../" + filename + "[leveloffset=+1]").append(NL);
        out.append(NL);
        out.append("[id='type-").append(cls.getSimpleName()).append("-schema-{context}']").append(NL);
        out.append("==== `").append(cls.getSimpleName()).append("` schema properties").append(NL);
        out.append(NL);
    } else if (description != null) {
        out.append(getDescription(description)).append(NL);
    }
    out.append(NL);
}
Also used : Description(io.strimzi.crdgenerator.annotations.Description) DescriptionFile(io.strimzi.crdgenerator.annotations.DescriptionFile) DescriptionFile(io.strimzi.crdgenerator.annotations.DescriptionFile) File(java.io.File)

Aggregations

Description (io.strimzi.crdgenerator.annotations.Description)2 DescriptionFile (io.strimzi.crdgenerator.annotations.DescriptionFile)2 File (java.io.File)2