db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: [patch] big string concatenation change in ClassDescriptor
Date Sun, 13 Jun 2004 08:27:53 GMT
hi robert,

thanks for these patches; i just commited to the repository.
cvs diff -u is fine, i can now apply them using eclipse.

jakob

Robert Sfeir wrote:

> Index: ClassDescriptor.java
> ===================================================================
> RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
> retrieving revision 1.85
> diff -u -r1.85 ClassDescriptor.java
> --- ClassDescriptor.java	6 May 2004 19:40:36 -0000	1.85
> +++ ClassDescriptor.java	11 Jun 2004 19:45:30 -0000
> @@ -1348,23 +1348,23 @@
>          String eol = System.getProperty("line.separator");
>  
>          // comment on class
> -        String result =
> -            eol + "  <!-- Mapping for Class " + this.getClassNameOfObject() + " -->"
+ eol;
> +        StringBuffer result = new StringBuffer(1024);
> +        result.append( eol + "  <!-- Mapping for Class " + this.getClassNameOfObject()
+ " -->" + eol );
>  
>          // opening tag and attributes
> -        result += "  " + tags.getOpeningTagNonClosingById(CLASS_DESCRIPTOR) + eol;
> +        result.append( "  " + tags.getOpeningTagNonClosingById(CLASS_DESCRIPTOR) + eol
);
>  
>          // class
> -        result += "    " + tags.getAttribute(CLASS_NAME, this.getClassNameOfObject())
+ eol;
> +        result.append( "    " + tags.getAttribute(CLASS_NAME, this.getClassNameOfObject())
+ eol );
>  
>          // isolation level is optional
>          if (null != getRepository())
>          {
>              if (getIsolationLevel() != this.getRepository().getDefaultIsolationLevel())
>              {
> -                result += "    "
> +                result.append( "    "
>                      + tags.getAttribute(ISOLATION_LEVEL, this.isolationLevelXml())
> -                    + eol;
> +                    + eol );
>              }
>          }
>  
> @@ -1385,71 +1385,71 @@
>  	{
>  	    if (ProxyHelper.isNormalOjbProxy(theProxyClass))   // tomdz: What about VirtualProxy
?
>              {
> -        	result += "    " + tags.getAttribute(CLASS_PROXY, "dynamic") + eol;
> +        	result.append( "    " + tags.getAttribute(CLASS_PROXY, "dynamic") + eol );
>      	    }
>              else
>  	    {
> -    	        result += "    " + tags.getAttribute(CLASS_PROXY, this.getProxyClassName())
+ eol;
> +    	        result.append( "    " + tags.getAttribute(CLASS_PROXY, this.getProxyClassName())
+ eol );
>              }
> -            result += "        " + tags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit())
+ eol;
> +            result.append( "        " + tags.getAttribute(PROXY_PREFETCHING_LIMIT, ""
+ this.getProxyPrefetchingLimit()) + eol );
>  	}
>  
>          // schema is optional
>          if (this.getSchema() != null)
>          {
> -            result += "    " + tags.getAttribute(SCHEMA_NAME, this.getSchema()) + eol;
> +            result.append( "    " + tags.getAttribute(SCHEMA_NAME, this.getSchema())
+ eol );
>          }
>  
>          // table name
>          if (this.getTableName() != null)
>          {
> -            result += "    " + tags.getAttribute(TABLE_NAME, this.getTableName()) +
eol;
> +            result.append("    " + tags.getAttribute(TABLE_NAME, this.getTableName())
+ eol );
>          }
>  
>          // rowreader is optional
>          if (this.getRowReaderClassName() != null)
>          {
> -            result += "    " + tags.getAttribute(ROW_READER, this.getRowReaderClassName())
+ eol;
> +            result.append( "    " + tags.getAttribute(ROW_READER, this.getRowReaderClassName())
+ eol );
>          }
>  
>          //accept-locks is optional, enabled by default
>          if (!this.acceptLocks)
>          {
> -            result += "        " + tags.getAttribute(ACCEPT_LOCKS, "false") + eol;
> +            result.append( "        " + tags.getAttribute(ACCEPT_LOCKS, "false") + eol
);
>          }
>          // sequence manager attribute not yet implemented
>  
>          // initialization method is optional
>          if (this.getInitializationMethod() != null)
>          {
> -            result += "    "
> +            result.append( "    "
>                  + tags.getAttribute(INITIALIZATION_METHOD, this.getInitializationMethod().getName())
> -                + eol;
> +                + eol );
>          }
>  
>          // factory class is optional
>          if (this.getFactoryClass() != null)
>          {
> -            result += "    "
> +            result.append( "    "
>                  + tags.getAttribute(FACTORY_CLASS, this.getFactoryClass().getName())
> -                + eol;
> +                + eol );
>          }
>  
>          //	factory method is optional
>          if (this.getFactoryMethod() != null)
>          {
> -            result += "    "
> +            result.append( "    "
>                  + tags.getAttribute(FACTORY_METHOD, this.getFactoryMethod().getName())
> -                + eol;
> +                + eol );
>          }
>  
>          //reference refresh is optional, disabled by default
>          if (isAlwaysRefresh())
>          {
> -            result += "    " + tags.getAttribute(REFRESH, "true") + eol;
> +            result.append( "    " + tags.getAttribute(REFRESH, "true") + eol );
>          }
>  
> -        result += "  >" + eol;
> +        result.append( "  >" + eol );
>  
>          // end of attributes
>  
> @@ -1459,9 +1459,9 @@
>              // extent-class
>              for (int i = 0; i < getExtentClassNames().size(); i++)
>              {
> -                result += "      " + tags.getOpeningTagNonClosingById(CLASS_EXTENT)
+ " ";
> -                result += tags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString());
> -                result += " />" + eol;
> +                result.append( "      " + tags.getOpeningTagNonClosingById(CLASS_EXTENT)
+ " " );
> +                result.append( tags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString())
);
> +                result.append( " />" + eol );
>              }
>          }
>          else
> @@ -1471,9 +1471,9 @@
>              {
>                  for (int i = 0; i < getExtentClassNames().size(); i++)
>                  {
> -                    result += "      " + tags.getOpeningTagNonClosingById(CLASS_EXTENT)
+ " ";
> -                    result += tags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString());
> -                    result += " />" + eol;
> +                    result.append( "      " + tags.getOpeningTagNonClosingById(CLASS_EXTENT)
+ " " );
> +                    result.append( tags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString())
);
> +                    result.append( " />" + eol );
>                  }
>              }
>  
> @@ -1481,46 +1481,46 @@
>              FieldDescriptor[] fields = getFieldDescriptions();
>              for (int i = 0; i < fields.length; i++)
>              {
> -                result += fields[i].toXML();
> +                result.append( fields[i].toXML() );
>              }
>  
>              // write optional ReferenceDescriptors
>              Vector refs = getObjectReferenceDescriptors();
>              for (int i = 0; i < refs.size(); i++)
>              {
> -                result += ((ObjectReferenceDescriptor) refs.get(i)).toXML();
> +                result.append( ((ObjectReferenceDescriptor) refs.get(i)).toXML() );
>              }
>  
>              // write optional CollectionDescriptors
>              Vector cols = getCollectionDescriptors();
>              for (int i = 0; i < cols.size(); i++)
>              {
> -                result += ((CollectionDescriptor) cols.get(i)).toXML();
> +                result.append( ((CollectionDescriptor) cols.get(i)).toXML() );
>              }
>  
>              // write optional IndexDescriptors
>              for (int i = 0; i < indexes.size(); i++)
>              {
>                  IndexDescriptor indexDescriptor = (IndexDescriptor) indexes.elementAt(i);
> -                result += indexDescriptor.toXML();
> +                result.append( indexDescriptor.toXML() );
>              }
>  
>              // Write out the procedures
>              if (this.getInsertProcedure() != null)
>              {
> -                result += this.getInsertProcedure().toXML();
> +                result.append( this.getInsertProcedure().toXML() );
>              }
>              if (this.getUpdateProcedure() != null)
>              {
> -                result += this.getUpdateProcedure().toXML();
> +                result.append( this.getUpdateProcedure().toXML() );
>              }
>              if (this.getDeleteProcedure() != null)
>              {
> -                result += this.getDeleteProcedure().toXML();
> +                result.append( this.getDeleteProcedure().toXML() );
>              }
>          }
> -        result += "  " + tags.getClosingTagById(CLASS_DESCRIPTOR);
> -        return result;
> +        result.append( "  " + tags.getClosingTagById(CLASS_DESCRIPTOR) );
> +        return result.toString();
>      }
>  
>      private String isolationLevelXml()
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 
> Jakob made the change with cvs diff -u looks like it matches closer to 
> what you got in Eclipse.
> 
> I've compiled and run the test for this change and did not get failures.
> 
> R
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message