Appearance
@DisplayFormat
The @DisplayFormat annotation defines how an entity or field is represented as text. This affects how entities appear in dropdowns, relationships, tables, search results, and anywhere a text representation is needed.
Usage on Entities
java
@DisplayFormat("${reference} - ${name}")
@SquizyEntity
@Entity
public class Product {
private String reference;
private String name;
}This is equivalent to using the displayFormat attribute on @SquizyEntity:
java
@SquizyEntity(displayFormat = "${reference} - ${name}")
@Entity
public class Product { /* ... */ }Usage on Fields
Override how a referenced entity is displayed for a specific relationship field:
java
@Entity
@SquizyEntity
public class Address {
@DisplayFormat("${id} - ${name}")
@ManyToOne
private City city;
}This overrides City's own display format only when displayed as a field of Address. This is equivalent to using @SquizyField(displayFormat = ...).
Placeholder Syntax
Use ${fieldName} to reference entity fields:
${name}— simple field${city.name}— nested field (traverse relationships)
The same syntax is used by @SortingExpression and @DefaultTableSortingExpression.
Auto-Generated Format
When no @DisplayFormat is specified, the framework generates one based on the entity's ID fields. See Display Format Guessing for details.
Related
@SquizyEntity— thedisplayFormatattribute@SquizyField— field-level display format override- Display Format feature guide — overview and use cases