Links

Java

Java is the target language by default, so you don't have to define it explicitly.
However, you can define it with the following instruction :
#set( $env.language = 'Java' )
The information below shows the behavior of the generator when Java is the current target language. For a detailed description of type conversion, see the generated documentation : https://www.telosys.org/doc/latest/languages/language-java.html

Types conversion

The table below describes how model neutral types are automatically converted to Java types with potential impact due to attribute annotations.
Model type
Java type
with annotation
string
String
byte
Byte byte byte
@NotNull @PrimitiveType
short
Short
short
short
@NotNull @PrimitiveType
int
Integer int
int
@NotNull @PrimitiveType
long
Long
long
long
@NotNull @PrimitiveType
decimal
BigDecimal
float
Float
float
float
@NotNull @PrimitiveType
double
Double
double
double
@NotNull @PrimitiveType
boolean
Boolean
boolean
boolean
@NotNull @PrimitiveType
date
LocalDate (since v 4.0) Date (before v 4.0)
time
LocalTime (since v 4.0) Date (before v 4.0)
timestamp
LocalDateTime (since v 4.0) Date (before v 4.0)
binary
byte [ ]

Annotations effects

  • @UnsignedType no effect (all numeric types are signed in Java)
  • @ObjectType switches to the standard wrapper type for the current type (Byte, Short, Integer, Long, Float, Double, Boolean)
  • @PrimitiveType switches to the primitive type if possible (byte, short, int, long, float, double, boolean)
  • @NotNull switches to primitive type if possible in order to avoid 'null' value

Specific types

  • $attribute.fullType
    • for an "object type" returns the fully-qualified class name (java.lang.String, java.lang.Integer, java.math.BigDecimal, etc )
    • for a "primitive type" returns the primitive type as is
      ( int, double, etc )
  • $attribute.simpleType
    • for an "object type" returns the simple class name ( String, Integer, Double, etc )
    • for a "primitive type" returns the primitive type as is
      ( int, double, etc )
  • $attribute.wrapperType returns the Java wrapper type class associtated with the current type (Integer, Double, etc )
Last modified 2d ago