All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jooq.codegen.JavaLombokGenerator Maven / Gradle / Ivy

There is a newer version: 0.1.18
Show newest version
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
 * 
    *
  1. javax.annotation.(processing?.)Generated only has SOURCE retention, * while lombok.Generated CLASS retention.
  2. *
  3. lombok.Generated is ignored by jacoco when calculating code coverage
  4. *
* * 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