You can define an element, and point the element definition to another element definition. This section introduces how to define element reference and alias.
Define element reference
Take the following sample for example:
public class SimpleElement { private String fieldA; private int fieldB; //getters and setters here } public class ComplexElement { private String fieldA; private SimpleElement simpleElement1; private SimpleElement simpleElement2; //getters and setters here }
To refer to another element, you must use ref as tag name. And the value of the attribute refId should be the id of the referred element instance.
Following is another sample element:
public interface ProductInterface { //Some logic here } public class MyProduct { public MyProduct(String content) { //Some logic here } //Some logic here }
You can also use the tag ref to define alias for an element instance. Take the following element for example:
public class SimpleElement { private String fieldA; private int fieldB; //getters and setters here } public class ComplexElement { private String fieldA; private SimpleElement simpleElement1; private SimpleElement simpleElement2; //getters and setters here }