Telosys doc
WebsiteTwitterLinkedInNews
  • Telosys documentation
  • Telosys CLI
    • Installation on Linux
    • Installation on Windows
    • CLI configuration
    • CLI commands
    • Getting started
  • Telosys with VSCode
    • Extension installation
    • VSCode settings
    • Telosys terminal in VSCode
    • Telosys editor configuration
  • Telosys with JetBrains IDE
  • Project configuration
  • Project variables
  • Project databases
  • Models and entities
    • Model structure
    • Entity
    • Attribute / Link
    • Annotations
    • Tags
    • Examples
    • Model creation
    • Model installation
    • Models management
  • Bundles of templates
    • Bundle structure
    • Bundle creation
    • Bundles installation
    • Bundles management
    • Velocity language
    • Velocity directives
    • Velocity object types
    • Telosys directives
    • Telosys variables
    • Telosys objects
    • Code snippets
  • Code generation
    • "gen" command
    • "genb" command
  • Target languages
    • C++
    • C#
    • Golang
    • Java
    • JavaScript
    • Kotlin
    • PHP
    • Python
    • Scala
    • TypeScript
  • Target databases (SQL)
    • Predefined rules
    • Specific rules
    • Type size and precision
  • Telosys with Git
    • GitHub usage
    • Install with Git
    • Publish with Git
  • Support the project
  • How to contribute
  • Sponsors
  • IDE and editors
  • Telosys 3 Eclipse plugin
    • Eclipse plugin installation
    • Eclipse customization
    • Telosys 3 database model
Powered by GitBook
On this page
  • Types conversion
  • Annotations effects
  • Literal values
  • TRUE, FALSE, NULL
  1. Target languages

Kotlin

PreviousJavaScriptNextPHP

Last updated 1 year ago

Kotlin is a predefined target language since Telosys version 4.1.0

To define Kotlin as the target language in a template file :

#set( $env.language = 'Kotlin' )

A "?" is automatically added to the end of the type if the attribute is "nullable" (no "@NotNull" annotation). To disable this behavior:

#set( $env.typeWithNullableMark = false )

The information below shows the behavior of the generator when Kotlin is the current target language. For a detailed description of type conversion, see the generated documentation :

Types conversion

The table below describes how model neutral types are automatically converted to Kotlin types with potential impact due to attribute annotations.

The table below describes how model neutral types are automatically converted to C# types with potential impact due to attribute annotations.

Model type
Kotlin type
with annotation

string

String? String

@NotNull

byte

Byte? UByte? Byte

@UnsignedType @NotNull

short

Short? UShort? Short

@UnsignedType @NotNull

int

Int? UInt? Int

@UnsignedType @NotNull

long

Long? ULong? Long

@UnsignedType

@NotNull

decimal

BigDecimal? BigDecimal

@NotNull

float

Float? Float

@NotNull

double

Double? Double

@NotNull

boolean

Boolean? Boolean

@NotNull

date

LocalDate?

LocalDate

@NotNull

time

LocalTime?

LocalTime

@NotNull

timestamp

LocalDateTime? LocalDateTime

@NotNull

binary

ByteArray? ByteArray

@NotNull

Annotations effects

  • @UnsignedType has effect only for byte, short, int, long

  • @ObjectType no effect

  • @NotNull type not nullable => no "?" at the end of the type

  • @PrimitiveType no effect

Literal values

TRUE, FALSE, NULL

Kotlin literal

TRUE

true

FALSE

false

NULL

null

https://www.telosys.org/doc/latest/languages/language-kotlin.html