FAQ

Computate Java class Reference

How to write Java classes that write massive amounts of code for you

TrafficSimulationGen class comments

Given the Java class declaration with the given class comments below:

/**
* {@inheritDoc}
 * Model: true
 * Api: true
 * Page: true
 * SuperPage.enUS: BaseModelPage
 * Indexed: true
 * Map.Integer.sqlSort: 2
 * Map.Integer.classSort: 5
 * ApiTag.enUS: Traffic Simulation
 * ApiUri.enUS: /api/traffic-simulation
 * ApiMethod.enUS: Search
 * ApiMethod: GET
 * ApiMethod: PATCH
 * ApiMethod: POST
 * ApiMethod: PUTImport
 * ApiMethod.enUS: SearchPage
 * Page.SearchPage.enUS: TrafficSimulationPage
 * PageSuper.SearchPage.enUS: BaseModelPage
 * ApiUri.SearchPage.enUS: /traffic-simulation
 * ApiMethod.enUS: MapSearchPage
 * Page.MapSearchPage.enUS: TrafficSimulationMapPage
 * PageSuper.MapSearchPage.enUS: BaseModelPage
 * ApiUri.MapSearchPage.enUS: /traffic-simulation-map
 * Role.enUS: SiteAdmin
 * Saves: true
 * AName.enUS: a traffic simulation
 * Color: 2017-shaded-spruce
 * IconGroup: duotone
 * IconName: traffic-light-stop
 * NameVar.enUS: trafficSimulation
 * Rows: 100
**/
public class TrafficSimulation extends TrafficSimulationGen<BaseModel> {
	...
}

extends TrafficSimulationGen

This Java class extends a generated Java class TrafficSimulationGen built by the https://github.com/computate-org/computate project. Whenever this Java class is modified or touched, the watch service installed as described in the README, indexes all the information about this Java class in a local Apache Solr Search Engine. If you are running the service, you can see the indexed data about this Java Class here:

Find the class TrafficSimulation in Solr.

The extended class ending with "Gen" did not exist at first, but was automatically created by the same watch service based on the data retrieved from the local Apache Server search engine. The extended class contains many generated fields, getters, setters, initialization code, and helper methods to help build a website and API fast, reactive, and scalable.

extends TrafficSimulationGen<BaseModel>

This class TrafficSimulation extends TrafficSimulationGen<BaseModel>, which means it extends a newly generated TrafficSimulationGen. The generated class TrafficSimulationGen extends BaseModel which means that TrafficSimulation extends TrafficSimulationGen which extends BaseModel. This generated inheritance is a powerful feature that allows a lot of boiler plate code to be created for you automatically while still preserving inheritance through the power of Java Generic classes.

AName: a traffic simulation

This class contains a comment "AName.enUS: a traffic simulation", which identifies the language context to describe a TrafficSimulation as "a traffic simulation".

Api: true

This class contains a comment "Api: true", which means this class will have Java Vert.x API backend code generated for these objects.

  • You can add a class comment "Api: true" if you wish to GET, POST, PATCH or PUT these TrafficSimulation objects in a RESTful API.

ApiTag.enUS: Traffic Simulation

This class contains a comment "ApiTag: Traffic Simulation", which groups all of the OpenAPIs for TrafficSimulation objects under the tag "Traffic Simulation".

ApiUri.enUS: /api/traffic-simulation

This class contains a comment "ApiUri: /api/traffic-simulation", which defines the base API URI for TrafficSimulation objects as "/api/traffic-simulation" in the OpenAPI spec.

Color: 2017-shaded-spruce

This class contains a comment "Color: 2017-shaded-spruce", which styles the TrafficSimulation page "2017-shaded-spruce". This will reference a CSS class defined by the stylesheets in the project that starts with "w3-". A css class of "w3-2017-shaded-spruce" is expected to exist in the project stylesheets, and is inspired by W3 CSS colors. See: https://www.w3schools.com/w3css/w3css_colors.asp.

IconGroup: duotone

This class contains a comment "IconGroup: duotone", which adds icons on the TrafficSimulation page with a group of "duotone". This will reference a Font Awesome icon group that starts with "fa-" followed by the icon group "duotone", together is "fa-duotone". A Font Awesome icon group of "duotone" is expected to exist. The Font Awesome groups currently supported include: solid, regular, light, thin, duotone, and sharp. See: https://fontawesome.com/docs/web/dig-deeper/styles.

IconName: traffic-light-stop

This class contains a comment "IconName: traffic-light-stop", which adds icons on the TrafficSimulation page with a name of "traffic-light-stop". This will reference a Font Awesome icon that starts with the icon group "fa-duotone fa-" followed by the icon name, which is "fa-duotone fa-traffic-light-stop". A Font Awesome icon of "fa-duotone fa-traffic-light-stop" is expected to exist. See: https://fontawesome.com/icons.

Indexed: true

This class contains a comment "Indexed: true", which means this class will be indexed in the search engine. Every protected void method that begins with "_" that is marked to be searched with a comment like "Indexed: true", "Stored: true", or "DocValues: true" will be indexed in the search engine.

{@inheritDoc}

By adding a class comment "{@inheritDoc}", the TrafficSimulation class will inherit the helpful inherited class comments from the super class TrafficSimulationGen.

  • You can add a class comment "{@inheritDoc}" if you wish to inherit the helpful inherited class comments from class TrafficSimulationGen into the class TrafficSimulation.

Model: true

This class contains a comment "Model: true", which means this class will be stored in the database. Every protected void method that begins with "_" that contains a "Persist: true" comment will be a persisted field in the database table.

  • You can add a class comment "Model: true" if you wish to persist these TrafficSimulation objects in a relational PostgreSQL database transactionally in the RESTful API. The code to persist and query the TrafficSimulationGen data in the database will then be automatically generated.

Page: true

This class contains a comment "Page: true", which means this class will have webpage code generated for these objects. Java Vert.x backend API code, Handlebars HTML template frontend code, and JavaScript code will all generated and can be extended. This creates a new Java class org.computate.smartvillageview.enus.model.traffic.simulation.TrafficSimulationPage.

Promise: true

This class contains a comment "Promise: true" Sometimes a Java class must be initialized asynchronously when it involves calling a blocking API. This means that the TrafficSimulation Java class has promiseDeep methods which must be initialized asynchronously as a Vert.x Promise instead of initDeep methods which are a simple non-asynchronous method.

Adding protected void methods beginning with an underscore with a Promise as the only parameter will automatically set `Promise: true`.

  
  	protected void _promiseBefore(Promise<Void> promise) {
  		promise.complete();
  	}
  

Java classes with the `Model: true` will automatically set `Promise: true`.

If a super class of this Java class with `Model: true`, then the child class will also inherit `Promise: true`.

Role.enUS: SiteAdmin

This class contains a comment "Role.enUS: SiteAdmin", which identifies the default role name "SiteAdmin" of the OAuth2/OpenID Connect user role required to access this TrafficSimulation API. It's possible to reconfigure the roles required to access the TrafficSimulation API by configuring an environment variable like this:

AUTH_ROLES_REQUIRED_TrafficSimulation: ["SiteAdmin"]

Rows: 100

This class contains a comment "Rows: 100", which means the TrafficSimulation API will return a default of 100 records instead of 10 by default. Each API has built in pagination of the search records to ensure a user can query all the data a page at a time without running the application out of memory.

  • You can add a class comment "Rows: 100" if you wish the TrafficSimulation API to return more or less than 10 records by default. In this case, the API will return 100 records from the API instead of 10 by default. Each API has built in pagination of the search records to ensure a user can query all the data a page at a time without running the application out of memory.

SuperPage.enUS: BaseModelPage

This class contains a comment "SuperPage.enUS: BaseModelPage", which identifies the Java super class of the page code by it's class simple name "BaseModelPage". This means that the newly created class org.computate.smartvillageview.enus.model.traffic.simulation.TrafficSimulationPage extends org.computate.smartvillageview.enus.model.base.BaseModelPage.