Example 4: Using a own meta model

This example shows how to use your own meta model. The default meta model, as used in the other examples is replaced by the java-5 meta model. The java 5 meta model is part of the distribution.

Configuring a meta model

To define a meta class for a XML-Element of your model you must use the "metaclass" element in the configuration. The metaclass element has three attributes:

Attribute Description
element The XML-Element to map on the specified class
class A java class to instantiate for the xml element.
stereotype if the xml element has a stereotype attribute and the
element name matches the specified element name and the
stereotype matches this stereotype, than the instantiator
will use this meta class. This makes it possible to map
several met classes to the same xml-element but with
different stereotypes

The distribution comes with two MetaConfig.xml files for a java-1.4 and a java 5 Metamodel. In this example we use the java-5 meta model. So you need a java 5 compiler.

How to start the example?

To start the example-3 go into the root-Directory "example" and start

          ant example-3

This should generate the bean and a interface into the src/java folder.

How does this work?

To be continued. For the moment look to the examples directory and try code studies.