Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

The Modello Data Model.

Here's an example of a modello data model.

Top level <model>

The top level <model> must contain an <id> <name> and at least 1 <classes><class> element.

The optional <defaults> tag is commonly used to define properties that the various modello generators use.

The <classes> section.

You can have 1 or more <class> elements within this section.

Each <class> represents a container for a set of <field>s.

Every <field> is a component in the container.

Notes on the <field> section

XML Generator Notes about <field>

  1. By default each <field> starts out life as an <element> with text content.
  2. A <field> can be set to be an attribute on the <class> element by using the <field xml.attribute="true"> syntax.
  3. field/name becomes the name of the element (or attribute key).
    1. field#xml.tagName can be used to change the name of the element (or attribute key)
  4. field/version is unused.
  5. field/description is unused.
  6. field/type is one of the following
    • boolean
    • char
    • double
    • int
    • long
    • short
    • date
    • String
    • Boolean
    • DOM (currently only supported by xpp3 generators)
    • Another <class> this is not working without using an association, as far as I could see
  7. field/association dictates the multiplicity of a field (1 to many, or 0 to many so far)
    1. generated readers and writers do not enforce the multiplicity rules (yet)
    2. field/association must have at a minimum the <type> element defined.
    3. field/association/type only refers to other <class> id's, no java primitives allowed here.
      1. field/association/type will be used to determine the name of the nested elements.
      2. singular form of the field tagname will be used for the nested element name.
        1. s/(.*)ies$/\1y/g - "Properies" becomes "Property"
        2. s/(.*(ch)?)es$/\1/g - "Branches" becomes "Branch"
        3. s/(.*)s$/\1/g - "Reports" becomes "Report"
      3. field/association#xml.associationTagName can be used to specify an overridden nested element name.
    4. {{field/assocation#xml.listStyle defaults to "wrapped".
      1. Example of field/assocation#xml.listStyle="wrapped"
      2. Example of field/assocation#xml.listStyle="flat"
      3. Example of field/assocation#xml.listStyle="flat"
  • No labels