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
  • Specific types
  1. Target languages

Java

PreviousGolangNextJavaScript

Last updated 1 year ago

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 :

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 )

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