37 lines
1.4 KiB
Twig
37 lines
1.4 KiB
Twig
{%- import 'utils.twig' as utils -%}
|
|
|
|
{%- set hasParent = parent is not null -%}
|
|
|
|
import ObjectMapper
|
|
|
|
{%- include 'blocks/class/date-transformers.twig' with { fields: fields } %}
|
|
|
|
/// {{ description }}
|
|
{% if (not hasChilds) -%}final {% endif %}class {% include 'blocks/class/classtype.twig' with { type: type } %}: {% include 'blocks/class/supertype.twig' with { type: type, parent: parent } %} {
|
|
|
|
{% include 'blocks/class/fields.twig' with { fields: fields } %}
|
|
// MARK: - Initializers
|
|
|
|
{% if (hasParent and (fields is empty)) %} override {% endif %}init({%- include 'blocks/class/init-parameters-fields.twig' with { fields: allFieldsOrdered } -%}) {
|
|
{%- include 'blocks/class/fields-initialization.twig' with { fields: fields } -%}
|
|
{% if hasParent %}
|
|
super.init({%- include 'blocks/class/fields-super-initialization.twig' with { fields: superclassesFields } -%})
|
|
{%- endif %}
|
|
}
|
|
|
|
required init(map: Map) throws {
|
|
{%- include 'blocks/class/fields-mapping-from-map.twig' with { fields: fields } -%}
|
|
{% if hasParent %}
|
|
try super.init(map: map)
|
|
{%- endif %}
|
|
}
|
|
|
|
{% if hasParent %} override {% endif %}func mapping(map: Map) {
|
|
{%- include 'blocks/class/fields-mapping-to-map.twig' with { fields: fields } -%}
|
|
{% if hasParent %}
|
|
super.mapping(map: map)
|
|
{%- endif %}
|
|
}
|
|
|
|
}
|