public void parse ( UNode appNode ) { assert appNode != null ; // Verify application name and save it. setAppName ( appNode . getName ( ) ) ; // Iterate through the application object's members. for ( String childName : appNode . getMemberNames ( ) ) { // See if we recognize this member. UNode childNode = appNode . getMember ( childName ) ; // "key" if ( childName . equals ( "key" ) ) { // Must be a value. Utils . require ( childNode . isValue ( ) , "'key' value must be a string: " + childNode ) ; Utils . require ( m_key == null , "'key' can be specified only once" ) ; m_key = childNode . getValue ( ) ; // "options" } else if ( childName . equals ( "options" ) ) { // Each name in the map is an option name. for ( String optName : childNode . getMemberNames ( ) ) { // Option must be a value. UNode optNode = childNode . getMember ( optName ) ; Utils . require ( optNode . isValue ( ) , "'option' must be a value: " + optNode ) ; setOption ( optNode . getName ( ) , optNode . getValue ( ) ) ; } // "tables" } else if ( childName . equals ( "tables" ) ) { // Should be specified only once. Utils . require ( m_tableMap . size ( ) == 0 , "'tables' can be specified only once" ) ; // Parse the table definitions, adding them to this app def and building // the external link map as we go. for ( UNode tableNode : childNode . getMemberList ( ) ) { // This will throw if the table definition has an error. TableDefinition tableDef = new TableDefinition ( ) ; tableDef . parse ( tableNode ) ; addTable ( tableDef ) ; } // Unrecognized } else { Utils . require ( false , "Unrecognized 'application' element: " + childName ) ; } } verify ( ) ; }
Parse the application definition rooted at given UNode tree and copy its contents into this object . The root node is the application object so its name is the application name and its child nodes are definitions such as key options fields etc . An exception is thrown if the definition contains an error .