Module is.codion.framework.domain
Interface ColumnTemplate<T>
- Type Parameters:
T- the column type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Specifies a reusable column configuration.
ColumnTemplate<Integer> REQUIRED_POSITIVE =
column -> column.as()
.column()
.nullable(false)
.minimum(0);
Customer.AGE.as(REQUIRED_POSITIVE)
.caption("Age")
A template configures the column from the ground up, so it is free to use any
Column.ColumnDefiner method, a subquery or primary key column is templated
just like a regular one.
static ColumnTemplate<Integer> count(String subquery) {
return column -> column.as()
.subquery(subquery)
.numberGrouping(true);
}
Templates compose by applying the one being extended.
ColumnTemplate<String> NAME =
column -> column.as()
.column()
.maximumLength(50)
.searchable(true);
ColumnTemplate<String> REQUIRED_NAME =
column -> NAME.apply(column)
.nullable(false);
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionApplies this template to the given column
-
Method Details
-
apply
Applies this template to the given column- Parameters:
column- the column- Returns:
- a
ColumnDefinition.Builderfor the given column
-