"Kotlin" language specificities

Telosys version : 4.1.0



To define Kotlin as the target language call  #set( $env.language = 'Kotlin' )  in the templates files.

The information below shows the behavior of the generator when 'Kotlin' is the current target language.



Type conversion ( model type to language type )

The language type conversion has an impact on :
Model type     Default        @UnsignedType @NotNull       @PrimitiveType @ObjectType   
string String? String? String String? String?
byte Byte? UByte? Byte Byte? Byte?
short Short? UShort? Short Short? Short?
int Int? UInt? Int Int? Int?
long Long? ULong? Long Long? Long?
decimal BigDecimal? BigDecimal? BigDecimal BigDecimal? BigDecimal?
float Float? Float? Float Float? Float?
double Double? Double? Double Double? Double?
boolean Boolean? Boolean? Boolean Boolean? Boolean?
date LocalDate? LocalDate? LocalDate LocalDate? LocalDate?
time LocalTime? LocalTime? LocalTime LocalTime? LocalTime?
timestamp LocalDateTime? LocalDateTime? LocalDateTime LocalDateTime? LocalDateTime?
binary ByteArray? ByteArray? ByteArray ByteArray? ByteArray?

Remarks

'@UnsignedType' :
  has effect only for 'byte', 'short', 'int' and 'long'
'@NotNull' :
  no effect on types, use '$kotlin' object for 'nullable type' with '?'
'@PrimitiveType' :
  no effect
'@ObjectType' :
  no effect



Literals for TRUE, FALSE and NULL

TRUE true
FALSE false
NULL null


Literal values

Model type Language type Language full type Language literal value example
string String? String? "AAA"
string String String "AAA"
byte Byte? Byte? 1
byte UByte? UByte? 1u
byte Byte Byte 1
short Short? Short? 1
short UShort? UShort? 1u
short Short Short 1
int Int? Int? 100
int UInt? UInt? 100u
int Int Int 100
long Long? Long? 1000
long ULong? ULong? 1000u
long Long Long 1000
decimal BigDecimal? java.math.BigDecimal? java.math.BigDecimal.valueOf(10000.77)
decimal BigDecimal java.math.BigDecimal java.math.BigDecimal.valueOf(10000.77)
float Float? Float? 1000.5f
float Float Float 1000.5f
double Double? Double? 1000.66
double Double Double 1000.66
boolean Boolean? Boolean? true
boolean Boolean Boolean true
date LocalDate? java.time.LocalDate? java.time.LocalDate.parse("2001-06-22")
date LocalDate java.time.LocalDate java.time.LocalDate.parse("2001-06-22")
time LocalTime? java.time.LocalTime? java.time.LocalTime.parse("01:46:52")
time LocalTime java.time.LocalTime java.time.LocalTime.parse("01:46:52")
timestamp LocalDateTime? java.time.LocalDateTime? java.time.LocalDateTime.parse("2001-05-21T01:47:53")
timestamp LocalDateTime java.time.LocalDateTime java.time.LocalDateTime.parse("2001-05-21T01:47:53")
binary ByteArray? ByteArray? null
binary ByteArray ByteArray null