Skip to content

Overview Java

Description

There are two generators that are related to the Java programing language:

  • Java
  • Java Predef (is only needed for the development of code generators)

Generator Java

When executing the Java generator with a Virtual Developer Modeler file created with the DSL ‘Basic’, you can only generate bean classes with fields, getters and setters and enumerations. The Java generator can do much more than this, though. The additional functionality is used by more powerful generators that create more complex Java code that uses frameworks or technologies like for instance JEE or implement design patterns or a whole software architecture.

Generator Java Predef

The generator Java Predef takes jar (or jmod) files as input and generates Java code that can create object representations for all types contained in the jar files. To use this generator only makes sense when you want to develop code generators yourself. If you want to know more about this, please read the documentation for the development of code generators with and for Virtual Developer.

It is possible to just use a *.jar or *.jmod file as input. But furthermore it is also possible to add one *.properties file to the input model. The possible key value pairs are:

  • bundle.name
    Set the bundle name in the MANIFEST
  • bundle.version
    Set the bundle version in the MANIFEST, also used for Eport-Package
  • model.url
    An url where to download the java archive, if it is set the *.properties file is sufficient as input model. To download more than one java archive use model.url.0, model.url.1, …
  • import.version
    Set the version of the imports, all valid manifest version entries are allowed
  • import.version.vd.predef.some.package.name
    Set a specific version to this package and all subpackages
  • import.add
    Add an import entry to the manifest, to add more than one import us import.add.0, import.add.1, …

Example generate.properties file for keycloak (with some unnecessary imports):

bundle.version=4.1.0.Final
bundle.name=vd.predef.keycloak
model.url.0=http://central.maven.org/maven2/org/keycloak/keycloak-servlet-filter-adapter/4.1.0.Final/keycloak-servlet-filter-adapter-4.1.0.Final.jar
model.url.1=http://central.maven.org/maven2/org/keycloak/keycloak-core/4.1.0.Final/keycloak-core-4.1.0.Final.jar
model.url.2=http://central.maven.org/maven2/org/keycloak/keycloak-adapter-spi/4.1.0.Final/keycloak-adapter-spi-4.1.0.Final.jar
model.url.3=http://central.maven.org/maven2/org/keycloak/keycloak-servlet-adapter-spi/4.1.0.Final/keycloak-servlet-adapter-spi-4.1.0.Final.jar
model.url.4=http://central.maven.org/maven2/org/keycloak/keycloak-adapter-core/4.1.0.Final/keycloak-adapter-core-4.1.0.Final.jar
model.url.5=http://central.maven.org/maven2/org/keycloak/keycloak-common/4.1.0.Final/keycloak-common-4.1.0.Final.jar
model.url.6=http://central.maven.org/maven2/org/keycloak/keycloak-authz-client/4.1.0.Final/keycloak-authz-client-4.1.0.Final.jar
import.version.vd.predef.com.fasterxml.jackson=2.8.11
import.version.vd.predef.org.apache=4.4.4
import.version.vd.predef.org.bouncycastle=1.56.0
import.version.vd.predef.java=[8.0.0,11.0.0)
import.version.vd.predef.javax=8.0.0
import.version.vd.predef.org.jboss.logging=3.3.1
import.add.0=vd.predef.some.unnecessary.package
import.add.1=vd.predef.some.unnecessary.package.even.more
import.version.vd.predef.some.unnecessary.package=42.0.0

Prerequisites

Technologies, Frameworks, Libraries

  • Java
  • JSE standard libraries

Modeling

  • Virtual Developer Modeler
  • Domain Specific Languages: Basic

Generation

  • Virtual Developer Cloud Connector (Eclipse, Maven or CLI)