| ILOG JRules User Guide > Integrating Application Data > Reference > Mapping Between XML Schema and Dynamic Classes > Schema Types > Default Constructor Dynamic Methods |
Default Constructor Dynamic Methods |
PREVIOUS NEXT |
This example shows how to map a default constructor. A method is generated for each dynamic class. This method sets the attributes with their default values, if they exist. The following example includes a function that adds an instance of a dynamic class Book, with the default attribute title equal to None.
Here is the schema:
<complexType name="book">
<sequence>
<element name="ident"/>
<element name="title" minOccurs="0" default="None" />
</sequence>
</complexType>
Here is the XOM representation:
Class Book extends IlrXmlObject
{
String ident ;
String title ;
Book (); // default constructor
}
And here is the ilrmain function:
function void ilrmain(Object o) {
// Add a new book, default value: ( ident = null, title="None" )
insert ( new Book() );
}
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |