org.jooq.codegen.JavaLombokGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reportcard-jooq-generator Show documentation
Show all versions of reportcard-jooq-generator Show documentation
test report metrics and trend analysis reporting :: reportcard-jooq-generator
package org.jooq.codegen;
import org.jooq.meta.Definition;
import org.jooq.meta.TypedElementDefinition;
/**
* Uses lombok.Generated as a class annotation instead of a javax.annotation.(processing?.)Generated
*
* - javax.annotation.(processing?.)Generated only has
SOURCE
retention,
* while lombok.Generated CLASS
retention.
* - lombok.Generated is ignored by jacoco when calculating code coverage
*
*
* Note: lombok is not a dependency of jooq, so if you use this generator,
* it is YOUR responsibility to ensure your project supports the
* lombok.Generated annotation
*
* @see https://github.com/jOOQ/jOOQ/issues/8617
* @see https://github.com/jacoco/jacoco/pull/731
*/
@SuppressWarnings("unused")
public class JavaLombokGenerator extends JavaGenerator {
@Override
protected void printClassAnnotations(JavaWriter out, Definition definition, GeneratorStrategy.Mode mode) {
if (generateGeneratedAnnotation()) {
String generated = "lombok.Generated";
out.println("@%s", out.ref(generated));
}
if (mode.equals(GeneratorStrategy.Mode.POJO)) {
out.println("@lombok.AllArgsConstructor");
out.println("@lombok.Data");
out.println("@lombok.experimental.SuperBuilder(toBuilder = true)");
out.println("@lombok.NoArgsConstructor");
}
//if (!scala) //TODO: uncomment when scala variable is protected instead of private
out.println("@%s({ \"all\", \"unchecked\", \"rawtypes\" })", out.ref("java.lang.SuppressWarnings"));
}
@Override
protected void generatePojoGetter(TypedElementDefinition> column, int index, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
@Override
protected void generatePojoSetter(TypedElementDefinition> column, int index, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
@Override
protected void generatePojoCopyConstructor(Definition tableOrUDT, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
@Override
protected void generatePojoMultiConstructor(Definition tableOrUDT, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
@Override
protected void generatePojoDefaultConstructor(Definition tableOrUDT, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
@Override
protected void generatePojoToString(Definition tableOrUDT, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
@Override
public boolean generatePojosEqualsAndHashCode() {
return false;
}
@Override
protected void generatePojoEqualsAndHashCode(Definition tableOrUDT, JavaWriter out) {
//No-op. Lombok handles boiler plate
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy