"Java" language specificities

Telosys version : 4.0.0



Java is the default target language
therefore it is not necessary to call '#set( $env.language = 'Java' )' in the templates files.

The information below shows the behavior of the generator when 'Java' 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 Byte byte byte Byte
short Short Short short short Short
int Integer Integer int int Integer
long Long Long 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 byte[] byte[] byte[] byte[] byte[]

Remarks

'@UnsignedType' :
  has no effect (all numeric types are signed in Java)
'@NotNull' :
  switches to primitive type if possible (in order to avoid 'null' value)
'@PrimitiveType' :
  switches to primitive type if possible (short, int, boolean, etc)
'@ObjectType' :
  switches primitive types to standard wrapper types (Short, Integer, Long, Float, etc)



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 java.lang.String "AAA"
byte Byte java.lang.Byte Byte.valueOf((byte)1)
byte byte byte (byte)1
short Short java.lang.Short Short.valueOf((short)1)
short short short (short)1
int Integer java.lang.Integer Integer.valueOf(100)
int int int 100
long Long java.lang.Long Long.valueOf(1000L)
long long long 1000L
decimal BigDecimal java.math.BigDecimal java.math.BigDecimal.valueOf(10000.77)
float Float java.lang.Float Float.valueOf(1000.5F)
float float float 1000.5F
double Double java.lang.Double Double.valueOf(1000.66D)
double double double 1000.66D
boolean Boolean java.lang.Boolean Boolean.valueOf(true)
boolean boolean boolean true
date LocalDate java.time.LocalDate java.time.LocalDate.parse("2001-06-22")
time LocalTime java.time.LocalTime java.time.LocalTime.parse("01:46:52")
timestamp LocalDateTime java.time.LocalDateTime java.time.LocalDateTime.parse("2001-05-21T01:46:52")
binary byte[] byte[] null