dart-jaguar.class.mustache Maven / Gradle / Ivy
{{#protoFormat}}
message {{classname}} {
{{#vars}}
{{#vendorExtensions}}{{{x-proto-type}}} {{name}} = {{x-index}}{{/vendorExtensions}};
{{/vars}}
}
{{/protoFormat}}
{{#jsonFormat}}
part '{{classFilename}}.jser.dart';
class {{classname}} {
{{#vars}}{{#description}} /* {{{.}}} */{{/description}}
@Alias('{{{baseName}}}', isNullable:{{#isNullable}} true{{/isNullable}}{{^isNullable}} false{{/isNullable}},{{#allowableValues}}
{{^enumVars.empty}}{{^isString}}{{! isString because inline enums are not handled for now }}
processor: const {{{datatype}}}FieldProcessor(),
{{/isString}}{{/enumVars.empty}}
{{/allowableValues}}
)
final {{{datatype}}} {{name}};
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}}{{/vars}}
{{classname}}(
{{#vars}}{{^defaultValue}}{{#required}} this.{{name}}, {{/required}}{{/defaultValue}}{{/vars}}
{{#vendorExtensions}}{{#x-has-vars}}{
{{#vars}}{{^required}} this.{{name}}{{#defaultValue}} = {{{defaultValue}}}{{^-last}}, {{/-last}} {{/defaultValue}}{{/required}}
{{#required}} {{#defaultValue}}this.{{name}} = {{{defaultValue}}}{{^-last}}, {{/-last}} {{/defaultValue}}{{/required}}{{/vars}}
}{{/x-has-vars}}{{/vendorExtensions}}
);
@override
String toString() {
return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]';
}
}
@GenSerializer(nullableFields: {{nullableFields}})
class {{classname}}Serializer extends Serializer<{{classname}}> with _${{classname}}Serializer {
}
{{/jsonFormat}}