Package st.orm

Annotation Interface Inline


@Target({RECORD_COMPONENT,PARAMETER}) @Retention(RUNTIME) public @interface Inline
Indicates that the underlying fields of the record component are inlined in this record.

This annotation must only be used on record components that are also records. Note that record components that do not specify @FK or converter annotations are implicitly regarded as inlined. Note that the @Inline is optional and can be omitted if the record component is inlined.

Example (Java):


 record City(@PK int id, String name, long population)
         implements Entity<Integer> {};

 record Address(String street, String postalCode, @FK City city) {};

 record User(@PK int id, String email, LocalDate birthDate, @Inline Address address)
         implements Entity<Integer> {};
 

Example (Kotlin):


 data class City(@PK val id: Int, val name: String, val population: Long)
     : Entity<Int>

 data class Address(val street: String, val postalCode: String, @FK val city: City)

 data class User(@PK val id: Int, val email: String, val birthDate: LocalDate,
                 @Inline val address: Address)
     : Entity<Int>
 

Is similar to:


 record User(@PK int id, String email, LocalDate birthDate,
             String street, String postalCode, @FK City city)
         implements Entity<Integer> {};

 record City(@PK int id, String name, long population)
         implements Entity<Integer> {};