Kotlin

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 : https://www.telosys.org/doc/latest/languages/language-kotlin.html

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 typeKotlin typewith 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

Last updated