Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Visibility Modifier (global)

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

By default, most generated code that is intended for use by users is generated using the explicit (Java) or implicit (Kotlin, Scala) public modifier.

In Kotlin there are valid reasons to deviate from this default, including:

  • -Xexplicit-api=strict is enabled, and it is a compilation error to omit the otherwise optional visibility modifier
  • The generated code should be generated as internal, not public

In the above cases, a configuration flag can help:

XML (standalone and maven)
Programmatic
Gradle (Kotlin)
Gradle (Groovy)
Gradle (third party)
<configuration>
  <generator>
    <generate>
      <!-- Possible values for visibilityModifier
         - DEFAULT  : The default per language (Java: public, Kotlin, Scala: implicit public)
         - NONE     : Do not generate visibility modifiers
         - PUBLIC   : Generate explicit public modifiers (Java, Kotlin)
         - INTERNAL : Generate explicit internal modifiers (Kotlin) -->
      <visibilityModifier>INTERNAL</visibilityModifier>
    </generate>
  </generator>
</configuration>

See the configuration XSD, standalone code generation, and maven code generation for more details.

new org.jooq.meta.jaxb.Configuration()
  .withGenerator(
    new Generate()

      // Possible values for visibilityModifier
      // - DEFAULT  : The default per language (Java: public, Kotlin, Scala: implicit public)
      // - NONE     : Do not generate visibility modifiers
      // - PUBLIC   : Generate explicit public modifiers (Java, Kotlin)
      // - INTERNAL : Generate explicit internal modifiers (Kotlin)
      .withVisibilityModifier(VisibilityModifier.INTERNAL)
  )

See the configuration XSD and programmatic code generation for more details.

import org.jooq.meta.jaxb.*


configuration {
  generator {
    generate {

      // Possible values for visibilityModifier
      // - DEFAULT  : The default per language (Java: public, Kotlin, Scala: implicit public)
      // - NONE     : Do not generate visibility modifiers
      // - PUBLIC   : Generate explicit public modifiers (Java, Kotlin)
      // - INTERNAL : Generate explicit internal modifiers (Kotlin)
      visibilityModifier = VisibilityModifier.INTERNAL
    }
  }
}

See the configuration XSD and gradle code generation for more details.

configuration {
  generator {
    generate {

      // Possible values for visibilityModifier
      // - DEFAULT  : The default per language (Java: public, Kotlin, Scala: implicit public)
      // - NONE     : Do not generate visibility modifiers
      // - PUBLIC   : Generate explicit public modifiers (Java, Kotlin)
      // - INTERNAL : Generate explicit internal modifiers (Kotlin)
      visibilityModifier = "INTERNAL"
    }
  }
}

See the configuration XSD and gradle code generation for more details.

generationTool {
  generator {
    generate {

      // Possible values for visibilityModifier
      // - DEFAULT  : The default per language (Java: public, Kotlin, Scala: implicit public)
      // - NONE     : Do not generate visibility modifiers
      // - PUBLIC   : Generate explicit public modifiers (Java, Kotlin)
      // - INTERNAL : Generate explicit internal modifiers (Kotlin)
      visibilityModifier = "INTERNAL"
    }
  }
}

See the configuration XSD and gradle code generation for more details.

Not all values make sense for all languages.

See also visibility modifiers per forced types for further options.

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo