api-generator-templates/Java/blocks/class/fields.twig

24 lines
812 B
Twig

{%- import '../../utils.twig' as utils -%}
{%- for field in fields %}
{%- if (field.description is not empty) %}
/**
* {{ field.description }}
*/
{%- endif %}
{{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }}
{%- if (storageAttributes is not null) %}
{%- if (field.type.storable) %}
@TypeConverters({{ field.type.type.baseTypeName }}.class)
{%- endif %}
{%- if (field.autoGenerate) %}
@PrimaryKey(autoGenerate = true)
{%- endif %}
{%- endif %}
{%- if (storageAttributes is null) or (field.autoGenerate != true) %}
@JsonField(name = "{{ field.jsonName }}")
{%- endif %}
private {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {{ field.name }};
{%- endfor -%}