$env

( documentation for Telosys generator version 4.1.0 )


Object for environment configuration
The 'environement' object is reset for each generation.

Since : 2.1.0

Attributes and methods
.collectionType : String

'collectionType' property defines a specific collection type for the current code generation
The given type will be used as the new default type for collections

Example :
   #set ( $env.collectionType = 'java.util.Set' ) ## for Java
   #set ( $env.collectionType = 'java.util.Vector' ) ## for Java
   #set ( $env.collectionType = 'Collection' ) ## for C#
   Current collection type is $env.collectionType

Since : 3.3.0

.database : String

'database' property defines the target database for SQL generation
The given database name will be used for SQL conversions (types and names)
(throws an exception if the database is unknown)

Example :
   #set ( $env.database = 'postgresql' )
   #set ( $env.database = 'mysql' )
   Current database type is $env.database

Since : 3.4.0

.databaseConvFile : File

'databaseConvFile' property defines the file containing the specific rules to be used for SQL generation
The given rules will be used for SQL conversions (types and names)
(throws an exception if the file cannot be found)

Example :
   #set ( $env.databaseConvFile = $fn.fileFromBundle('oracle.properties') )
   #set ( $env.databaseConvFile = $fn.fileFromBundle('mydb.properties') )

Since : 3.4.0

.entityClassNamePrefix : String

'entityClassNamePrefix' property defines the prefix to add before entity class name
Once the 'prefix' is defined in the 'environment object'
it is automatically applied when the entity class name is retrieved

Example :
   #set ( $env.entityClassNamePrefix = 'Bean' )

Since : 2.1.0

.entityClassNameSuffix : String

'entityClassNameSuffix' property defines the suffix to add after entity class name
Once the 'suffix' is defined in the 'environment object'
it is automatically applied when the entity class name is retrieved

Example :
   #set ( $env.entityClassNameSuffix = 'Entity' )

Since : 2.1.0

.language : String

'language' property defines the target language for the current code generation
See documentation for all supported languages ('Java', 'C#', 'Go', 'Python', 'JavaScript', 'TypeScript', etc)
The current language is 'Java' by default
This information is used determine language peculiarities like types and literal values
(throws an exception if the language is unknown)

Example :
   #set ( $env.language = 'C#' )
   #set ( $env.language = 'PHP' )
   Current target language is $env.language

Since : 3.0.0

.sql : SqlInContext

Returns an instance of '$sql' object
The $sql object is based on the current 'database' or on the current 'databaseConvFile'
(for debug information, not intended for use directly in template files)

Example :
   #set( $env.database = 'postgresql' )
   #set( $sql = $env.sql )

.typeWithNullableMark : boolean

'typeWithNullableMark' property defines if the 'nullable mark' must be used or not
This property is useful only for target languages like C#, Kotlin or PHP.
With this kind of languages a '?' is added at the end the type (eg C# : 'string?')
or at the beginning (eg PHP: '?string') if the attribute is nullable
The default value is 'true', it can be set to 'false' to avoid the 'nullable mark' in the type

Example :
   #set ( $env.typeWithNullableMark = false )
   Use type with nullable mark : $env.typeWithNullableMark

Since : 4.1.0