Dynamic field types
A dynamic document field definition requires a specific field type. The field type determines how the field value is handled, displayed and stored.
A field type usually corresponds with a specific Java type.
Example
The following is an example with both simple fields and custom field types.
document-definition:
name: person
types:
- id: street-name
base-type: string
- id: address
base-type: fieldset
fields:
- id: street-name
type: street-name
- id: street-nr
type: number
- id: zipcode
type: number
- id: company
base-type: fieldset
fields:
- id: name
type: string
label: Name
text:
description: Public company name
- id: activities
type: string[]
possible-values:
- building-software
- selling-cars
- destroying-houses
- id: founded
type: date
- id: operational
type: boolean
- id: shareholders
type: string
possible-values:
- private
- public
content:
- id: firstname
type: string
- id: lastname
type: string
- id: phone-number
type: string
- id: email
type: string
- id: description
type: text
- id: address
type: address
- id: company
type: company
Default type keys
The following type keys (for use in type
or base-type
) are available:
Type key | Field type | Description |
---|---|---|
|
Single-line text. |
|
|
Multi-line text. |
|
|
Single character. |
|
|
Whole number ( |
|
|
Whole number ( |
|
|
Whole number ( |
|
|
Whole number ( |
|
|
Floating point number ( |
|
|
Floating point number ( |
|
|
Floating point number ( |
|
|
Floating point number ( |
|
|
Boolean ( |
|
|
A date without a time-zone. |
|
|
A time without a time-zone. |
|
|
A date-time without a time-zone. |
|
|
Collection of nested fields. |
|
|
Linked entity field (for example a |
|
|
References a |
|
|
References a |
|
|
References a |
|
|
References a |
Enumerations
Several base types can be turned into an enumeration by specifying the possible-values
.
See the separate page for more information.
Custom types
The example shows the use of custom field types. The chapter on creating a custom type gives more information on how to to this.