Eiffel.model.mustache Maven / Gradle / Ivy
{{>noteinfo}}
{{#models}}
{{#model}}
class {{classname}}
inherit
ANY
redefine
out
{{#parent}}
select
out
{{/parent}}
end
{{#parent}}
{{{parent}}}
rename
out as out_{{{parentSchema}}}
end
{{/parent}}
feature --Access
{{#vars}}
{{^isInherited}}
{{#isPrimitiveType}}
{{name}}: {{{datatype}}}
{{#description}}-- {{{description}}}{{/description}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isContainer}}
{{name}}: detachable {{{datatypeWithEnum}}}
{{#description}}-- {{{description}}}{{/description}}
{{/isContainer}}
{{^isContainer}}
{{name}}: detachable {{{datatype}}}
{{#description}}-- {{{description}}}{{/description}}
{{/isContainer}}
{{/isPrimitiveType}}
{{/isInherited}}
{{/vars}}
feature -- Change Element
{{#vars}}
{{^isInherited}}
set_{{name}} (a_name: like {{name}})
-- Set '{{name}}' with 'a_name'.
do
{{name}} := a_name
ensure
{{name}}_set: {{name}} = a_name
end
{{/isInherited}}
{{/vars}}
feature -- Status Report
out: STRING
--
do
create Result.make_empty
{{#parent}}
Result.append(out_{{{parentSchema}}})
{{/parent}}
Result.append("%Nclass {{classname}}%N")
{{#vars}}
{{^isInherited}}
{{#isListContainer}}
if attached {{name}} as l_{{name}} then
across l_{{name}} as ic loop
Result.append ("%N")
Result.append (ic.item.out)
Result.append ("%N")
end
end
{{/isListContainer}}
{{#isMapContainer}}
if attached {{name}} as l_{{name}} then
across l_{{name}} as ic loop
Result.append ("%N")
Result.append ("key:")
Result.append (ic.key.out)
Result.append (" - ")
Result.append ("val:")
Result.append (ic.item.out)
Result.append ("%N")
end
end
{{/isMapContainer}}
{{^isContainer}}
if attached {{name}} as l_{{name}} then
Result.append ("%N")
Result.append (l_{{name}}.out)
Result.append ("%N")
end
{{/isContainer}}
{{/isInherited}}
{{/vars}}
end
end
{{/model}}
{{/models}}