...
- By default each
<field>starts out life as an<element>with text content. - A
<field>can be set to be an attribute on the<class>element by using the<field xml.attribute="true">syntax. field/namebecomes the name of the element (or attribute key).field#xml.tagNamecan be used to change the name of the element (or attribute key)
field/versionis unused.field/descriptionis unused.field/typeis one of the following- boolean
- char
- double
- int
- long
- short
- date
- String
- Boolean
- DOM (currently only supported by xpp3 generators)
- Another
<class>this can only be achieved through an association tag
field/associationdictates the multiplicity of a field (1 to many, or 0 to many so far) allows linking to other classes of the model- generated readers and writers do not enforce the multiplicity rules (yet)
field/associationmust have at a minimum the <type> element defined.field/association/multiplicitydictates the multiplicity of a field (1 or*: 0 to many so far)field/association/typeonly refers to other <class> id's, no java primitives allowed here.field/association/typewill be used to determine the name of the nested elements.- singular form of the field tagname will be used for the nested element name.
s/(.*)ies$/\1y/g-"Properies"becomes"Property"s/(.*(ch)?)es$/\1/g-"Branches"becomes"Branch"s/(.*)s$/\1/g-"Reports"becomes"Report"
field/association#xml.associationTagNamecan be used to specify an overridden nested element name.- To learn more about tagName resolution, see TagName resolution
field#xml.listStyledefaults to "wrapped".- Example of
field#xml.listStyle="wrapped"Code Block xml <!-- Model --> <class> <name>example</name> <fields> <field xml.listStyle="wrapped"> <name>components</name> <version>4.0.0</version> <association> <type>Component</type> <multiplicity>*</multiplicity> </association> </field> </fields> </class> <class> <name>Component</name> <version>4.0.0</version> <fields> <field> <name>name</name> <type>String</type> </field> </fields> </class>Code Block xml <!-- xml --> <example> <components> <component> <name>foo</name> </component> <component> <name>bar</name> </component> </components> </example> - Example of
field#xml.listStyle="flat"Code Block xml <!-- Model --> <class> <name>example</name> <fields> <field xml.listStyle="flat"> <name>components</name> <version>4.0.0</version> <association> <type>Component</type> <multiplicity>*</multiplicity> </association> </field> </fields> </class> <class> <name>Component</name> <version>4.0.0</version> <fields> <field> <name>name</name> <type>String</type> </field> </fields> </class>Code Block xml <!-- xml --> <example> <component> <name>foo</name> </component> <component> <name>bar</name> </component> </example>
- Example of
