The validate() method in the pure java beans code is more optimized now: some for loops and if blocks are generated only if they need to be. BLD200306181049
authorcliffwd@netbeans.org
Tue, 17 Jun 2003 20:46:38 +0000
changeset 129720d15d8d6ac4
parent 1296 4d29e3f8911e
child 1298 26ae3362994d
The validate() method in the pure java beans code is more optimized now: some for loops and if blocks are generated only if they need to be.
Fixed a bug in the pure java beans where an attribute (like xml:lang) of a primitive element (like a String) used to not inherit the element's groupness. So, the element might become a String[], therefore the attribute needs to be an array too.
Pure java beans can now name themselves (nameSelf method) and their children (nameChild method). This can be used to provide an absolute location to property change events.
schema2beans/test/unit/src/TestMain.java
schema2beans/test/unit/src/data/TestMerge.java
schema2beans/test/unit/src/data/TestWebApp.java
schema2beans/test/unit/src/data/goldenfiles/TestMain/testAttr.pass
schema2beans/test/unit/src/data/goldenfiles/TestMain/testEncoding.pass
schema2beans/test/unit/src/data/goldenfiles/TestMain/testGroupUnbounded.pass
schema2beans/test/unit/src/data/goldenfiles/TestMain/testMerge.pass
schema2beans/test/unit/src/data/goldenfiles/TestMain/testWebAppDelegatorBaseBean.pass
     1.1 --- a/schema2beans/test/unit/src/TestMain.java	Mon Jun 16 21:40:39 2003 +0000
     1.2 +++ b/schema2beans/test/unit/src/TestMain.java	Tue Jun 17 20:46:38 2003 +0000
     1.3 @@ -419,7 +419,7 @@
     1.4          theClassPath += classPathEntryFromURL(org.netbeans.modules.schema2beans.BaseBean.class);
     1.5          theClassPath += File.pathSeparator + classPathEntryFromURL(org.w3c.dom.Node.class);
     1.6          theClassPath += File.pathSeparator + classPathEntryFromURL(javax.xml.parsers.DocumentBuilderFactory.newInstance().getClass());
     1.7 -        theClassPath += File.pathSeparator + classPathEntryFromURL(org.w3c.dom.ranges.DocumentRange.class);
     1.8 +        //theClassPath += File.pathSeparator + classPathEntryFromURL(org.w3c.dom.ranges.DocumentRange.class);
     1.9          System.out.println("classpath="+theClassPath);
    1.10      }
    1.11  
     2.1 --- a/schema2beans/test/unit/src/data/TestMerge.java	Mon Jun 16 21:40:39 2003 +0000
     2.2 +++ b/schema2beans/test/unit/src/data/TestMerge.java	Tue Jun 17 20:46:38 2003 +0000
     2.3 @@ -36,7 +36,7 @@
     2.4      // to make sure that any change in schema2beans does not introduce a 
     2.5      // significant increase of mem usage.
     2.6      //
     2.7 -    static float memUsageReference = 5343;
     2.8 +    static float memUsageReference = 1241;
     2.9  
    2.10      
    2.11      public class MyListener implements PropertyChangeListener {
    2.12 @@ -514,14 +514,14 @@
    2.13  	if (diff > 0) {
    2.14  	    //	We consume more memory than excepted
    2.15  	    float p = diff/memUsageReference*100;
    2.16 -	    if (p > 0.5) {
    2.17 +	    if (p > 0.6) {
    2.18  		out("It seems that the last schema2beans code changes have increased the memory consumption by " + p + "%");
    2.19  		out("If this is expected and acceptable, change the memUsageReference value in TestMerge.java, to be " + k2);
    2.20  	    }
    2.21  	} else {
    2.22  	    //	We consume less memory than expected
    2.23  	    float p = Math.abs(diff)/memUsageReference*100;
    2.24 -	    if (p > 0.1) {
    2.25 +	    if (p > 0.2) {
    2.26  		out("It seems that the last schema2beans code changes have decreased the memory consumption by " + p + "% !!!");
    2.27  		out("Please, change the memUsageReference value in TestMerge.java, to be " + k2);
    2.28  	    }   
     3.1 --- a/schema2beans/test/unit/src/data/TestWebApp.java	Mon Jun 16 21:40:39 2003 +0000
     3.2 +++ b/schema2beans/test/unit/src/data/TestWebApp.java	Tue Jun 17 20:46:38 2003 +0000
     3.3 @@ -55,7 +55,7 @@
     3.4          out("Adding filters");
     3.5          FilterType filter = new FilterType();
     3.6          filter.addDisplayName("filter BLUE");
     3.7 -        filter.setDisplayNameXmlLang("en");
     3.8 +        filter.addDisplayNameXmlLang("en");
     3.9          webApp.addFilter(filter);
    3.10          filter = new FilterType();
    3.11          filter.addDisplayName("filter GREEN");
     4.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testAttr.pass	Mon Jun 16 21:40:39 2003 +0000
     4.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testAttr.pass	Tue Jun 17 20:46:38 2003 +0000
     4.3 @@ -62,9 +62,9 @@
     4.4  out: book - element
     4.5  out: attribute: good=yes
     4.6  out:   summary - element
     4.7 +out:   attribute: size=12
     4.8 +out:   attribute: length=133
     4.9  out:   attribute: lang=fr
    4.10 -out:   attribute: length=133
    4.11 -out:   attribute: size=12
    4.12  out:   chapter - element
    4.13  out:   chapter - element
    4.14  out:   chapter - element
    4.15 @@ -110,9 +110,9 @@
    4.16  out: book - element
    4.17  out: attribute: good=yes
    4.18  out:   summary - element
    4.19 +out:   attribute: size=12
    4.20 +out:   attribute: length=133
    4.21  out:   attribute: lang=fr
    4.22 -out:   attribute: length=133
    4.23 -out:   attribute: size=12
    4.24  out:   chapter - element
    4.25  out:   chapter - element
    4.26  out:   attribute: title=My chapter
    4.27 @@ -136,9 +136,9 @@
    4.28  out: book - element
    4.29  out: attribute: good=yes
    4.30  out:   summary - element
    4.31 +out:   attribute: size=12
    4.32 +out:   attribute: length=133
    4.33  out:   attribute: lang=fr
    4.34 -out:   attribute: length=133
    4.35 -out:   attribute: size=12
    4.36  out:     #text=
    4.37  out: 	This book is about the life of a book spent between books who dreamed
    4.38  out: 	to meet a fairy who could transform it into an XML book and travel
    4.39 @@ -191,9 +191,9 @@
    4.40  out:       page - element
    4.41  out:       line - element
    4.42  out:   index - element
    4.43 -out:   attribute: color=blue
    4.44  out:   attribute: cross-ref=yes
    4.45  out:   attribute: glossary=nope
    4.46 +out:   attribute: color=blue
    4.47  out:     word - element
    4.48  out:     attribute: freq=123
    4.49  out:       #text=my word - text
     5.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testEncoding.pass	Mon Jun 16 21:40:39 2003 +0000
     5.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testEncoding.pass	Tue Jun 17 20:46:38 2003 +0000
     5.3 @@ -85,7 +85,7 @@
     5.4  out: <!--                                                              -->
     5.5  out: <!-- <!DOCTYPE FORTEDDL SYSTEM "TestEncoding.dtd" []> -->
     5.6  out: <FORTEDDL>
     5.7 -out:   <PHASE NUMBER="1" OBJECTNAME="c1" OBJECTTYPE="MetaPlan.MetaClass">
     5.8 +out:   <PHASE OBJECTTYPE="MetaPlan.MetaClass" OBJECTNAME="c1" NUMBER="1">
     5.9  out:     <ATTRIBUTE NAME="Name">c1</ATTRIBUTE>
    5.10  out:     <ATTRIBUTE NAME="MethodArray">
    5.11  out:       <ARRAY>
    5.12 @@ -113,7 +113,7 @@
    5.13  out:         </MYOBJECT>
    5.14  out:       </ARRAY>
    5.15  out:     </ATTRIBUTE>
    5.16 -out:     <ANNOTATION NAME="cr1" OBJECTTYPE="CrossRefInfo">
    5.17 +out:     <ANNOTATION OBJECTTYPE="CrossRefInfo" NAME="cr1">
    5.18  out:       <ATTRIBUTE NAME="InfoArray">
    5.19  out:         <ARRAY>
    5.20  out:           <MYOBJECT CLASS="infoItem">
     6.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testGroupUnbounded.pass	Mon Jun 16 21:40:39 2003 +0000
     6.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testGroupUnbounded.pass	Tue Jun 17 20:46:38 2003 +0000
     6.3 @@ -23,11 +23,8 @@
     6.4  out: TestGroupUnbounded - bean graph created
     6.5  out: <?xml version='1.0' encoding='UTF-8' ?>
     6.6  out: <group-unbounded xmlns='http://foo.com/xml/group-unbounded' version=''>
     6.7 -out: 	<object id='b' type='green'>
     6.8 -out: 	</object>
     6.9 -out: 	<object id='a' type='blue'>
    6.10 -out: 	</object>
    6.11 -out: 	<iobject id='a' type='blue' value='stuff'>
    6.12 -out: 	</iobject>
    6.13 +out: 	<object id='b' type='green'/>
    6.14 +out: 	<object id='a' type='blue'/>
    6.15 +out: 	<iobject id='a' type='blue' value='stuff'/>
    6.16  out: </group-unbounded>
    6.17  Finished running TestGroupUnbounded: 0
     7.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testMerge.pass	Mon Jun 16 21:40:39 2003 +0000
     7.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testMerge.pass	Tue Jun 17 20:46:38 2003 +0000
     7.3 @@ -288,7 +288,7 @@
     7.4  out:   <author>
     7.5  out: 	Mikey Mouse
     7.6  out: 	</author>
     7.7 -out:   <index color="blue" cross-ref="no">
     7.8 +out:   <index cross-ref="no" color="blue">
     7.9  out:     <word>
    7.10  out: 			Good book
    7.11  out: 		</word>
    7.12 @@ -353,7 +353,7 @@
    7.13  out: 		</paragraph>
    7.14  out:   </chapter>
    7.15  out:   <!-- BLUE -->
    7.16 -out:   <summary lang="us" length="123" size="12">
    7.17 +out:   <summary size="12" length="123" lang="us">
    7.18  out: 	This book is about the life of a book spent between books who dreamed
    7.19  out: 	to meet a fairy who could transform it into an XML book and travel
    7.20  out: 	in an electronic boundary-less world.
     8.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testWebAppDelegatorBaseBean.pass	Mon Jun 16 21:40:39 2003 +0000
     8.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testWebAppDelegatorBaseBean.pass	Tue Jun 17 20:46:38 2003 +0000
     8.3 @@ -328,7 +328,7 @@
     8.4  out: TestWebAppDelegatorBaseBean null Got good validate exception: getWebResourceName() == null -> OK
     8.5  out: TestWebAppDelegatorBaseBean null Got good validate exception: sizeUrlPattern() == 0 -> OK
     8.6  out: <?xml version="1.0" encoding="UTF-8"?>
     8.7 -out: <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
     8.8 +out: <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4">
     8.9  out:   <description>Changed the description</description>
    8.10  out:   <display-name>MyWebApp</display-name>
    8.11  out:   <filter>
    8.12 @@ -360,7 +360,7 @@
    8.13  out: </web-app>
    8.14  out: TestWebAppDelegatorBaseBean - Add some descriptions with xml:lang attributes.
    8.15  out: <?xml version="1.0" encoding="UTF-8"?>
    8.16 -out: <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    8.17 +out: <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4">
    8.18  out:   <description xml:lang="en">Changed the description</description>
    8.19  out:   <description xml:lang="de">Das ist mein App.</description>
    8.20  out:   <display-name>MyWebApp</display-name>
    8.21 @@ -396,7 +396,7 @@
    8.22  out: TestWebAppDelegatorBaseBean null thing2 -> OK
    8.23  out: TestWebAppDelegatorBaseBean null thing3 -> OK
    8.24  out: <?xml version="1.0" encoding="UTF-8"?>
    8.25 -out: <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    8.26 +out: <web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    8.27  out:   <description xml:lang="en">Changed the description</description>
    8.28  out:   <description xml:lang="de">Das ist mein App.</description>
    8.29  out:   <display-name>MyWebApp</display-name>