Integrate hint from Teo Sarca

BUG ID 1617928 - Inefficient use of Boolean ctor for gen. model
Pending generation of the whole model for next version
This commit is contained in:
Carlos Ruiz 2006-12-20 08:51:51 +00:00
parent 1b56a542a1
commit e3b02cb1b0
2 changed files with 15 additions and 12 deletions

View File

@ -98,7 +98,7 @@ public void setAD_PrintFormat_ID (int AD_PrintFormat_ID)
{ {
if (AD_PrintFormat_ID <= 0) set_Value ("AD_PrintFormat_ID", null); if (AD_PrintFormat_ID <= 0) set_Value ("AD_PrintFormat_ID", null);
else else
set_Value ("AD_PrintFormat_ID", new Integer(AD_PrintFormat_ID)); set_Value ("AD_PrintFormat_ID", Integer.valueOf(AD_PrintFormat_ID));
} }
/** Get Print Format. /** Get Print Format.
@return Data Print Format */ @return Data Print Format */
@ -113,7 +113,7 @@ return ii.intValue();
public void setAD_Process_ID (int AD_Process_ID) public void setAD_Process_ID (int AD_Process_ID)
{ {
if (AD_Process_ID < 1) throw new IllegalArgumentException ("AD_Process_ID is mandatory."); if (AD_Process_ID < 1) throw new IllegalArgumentException ("AD_Process_ID is mandatory.");
set_ValueNoCheck ("AD_Process_ID", new Integer(AD_Process_ID)); set_ValueNoCheck ("AD_Process_ID", Integer.valueOf(AD_Process_ID));
} }
/** Get Process. /** Get Process.
@return Process or Report */ @return Process or Report */
@ -129,7 +129,7 @@ public void setAD_ReportView_ID (int AD_ReportView_ID)
{ {
if (AD_ReportView_ID <= 0) set_Value ("AD_ReportView_ID", null); if (AD_ReportView_ID <= 0) set_Value ("AD_ReportView_ID", null);
else else
set_Value ("AD_ReportView_ID", new Integer(AD_ReportView_ID)); set_Value ("AD_ReportView_ID", Integer.valueOf(AD_ReportView_ID));
} }
/** Get Report View. /** Get Report View.
@return View used to generate this report */ @return View used to generate this report */
@ -145,7 +145,7 @@ public void setAD_Workflow_ID (int AD_Workflow_ID)
{ {
if (AD_Workflow_ID <= 0) set_Value ("AD_Workflow_ID", null); if (AD_Workflow_ID <= 0) set_Value ("AD_Workflow_ID", null);
else else
set_Value ("AD_Workflow_ID", new Integer(AD_Workflow_ID)); set_Value ("AD_Workflow_ID", Integer.valueOf(AD_Workflow_ID));
} }
/** Get Workflow. /** Get Workflow.
@return Workflow or combination of tasks */ @return Workflow or combination of tasks */
@ -267,7 +267,7 @@ return (String)get_Value("Help");
@param IsBetaFunctionality This functionality is considered Beta */ @param IsBetaFunctionality This functionality is considered Beta */
public void setIsBetaFunctionality (boolean IsBetaFunctionality) public void setIsBetaFunctionality (boolean IsBetaFunctionality)
{ {
set_Value ("IsBetaFunctionality", new Boolean(IsBetaFunctionality)); set_Value ("IsBetaFunctionality", Boolean.valueOf(IsBetaFunctionality));
} }
/** Get Beta Functionality. /** Get Beta Functionality.
@return This functionality is considered Beta */ @return This functionality is considered Beta */
@ -285,7 +285,7 @@ return false;
@param IsDirectPrint Print without dialog */ @param IsDirectPrint Print without dialog */
public void setIsDirectPrint (boolean IsDirectPrint) public void setIsDirectPrint (boolean IsDirectPrint)
{ {
set_Value ("IsDirectPrint", new Boolean(IsDirectPrint)); set_Value ("IsDirectPrint", Boolean.valueOf(IsDirectPrint));
} }
/** Get Direct print. /** Get Direct print.
@return Print without dialog */ @return Print without dialog */
@ -303,7 +303,7 @@ return false;
@param IsReport Indicates a Report record */ @param IsReport Indicates a Report record */
public void setIsReport (boolean IsReport) public void setIsReport (boolean IsReport)
{ {
set_Value ("IsReport", new Boolean(IsReport)); set_Value ("IsReport", Boolean.valueOf(IsReport));
} }
/** Get Report. /** Get Report.
@return Indicates a Report record */ @return Indicates a Report record */
@ -321,7 +321,7 @@ return false;
@param IsServerProcess Run this Process on Server only */ @param IsServerProcess Run this Process on Server only */
public void setIsServerProcess (boolean IsServerProcess) public void setIsServerProcess (boolean IsServerProcess)
{ {
set_Value ("IsServerProcess", new Boolean(IsServerProcess)); set_Value ("IsServerProcess", Boolean.valueOf(IsServerProcess));
} }
/** Get Server Process. /** Get Server Process.
@return Run this Process on Server only */ @return Run this Process on Server only */
@ -402,7 +402,7 @@ return (String)get_Value("ShowHelp");
@param Statistic_Count Internal statistics how often the entity was used */ @param Statistic_Count Internal statistics how often the entity was used */
public void setStatistic_Count (int Statistic_Count) public void setStatistic_Count (int Statistic_Count)
{ {
set_Value ("Statistic_Count", new Integer(Statistic_Count)); set_Value ("Statistic_Count", Integer.valueOf(Statistic_Count));
} }
/** Get Statistic Count. /** Get Statistic Count.
@return Internal statistics how often the entity was used */ @return Internal statistics how often the entity was used */
@ -416,7 +416,7 @@ return ii.intValue();
@param Statistic_Seconds Internal statistics how many seconds a process took */ @param Statistic_Seconds Internal statistics how many seconds a process took */
public void setStatistic_Seconds (int Statistic_Seconds) public void setStatistic_Seconds (int Statistic_Seconds)
{ {
set_Value ("Statistic_Seconds", new Integer(Statistic_Seconds)); set_Value ("Statistic_Seconds", Integer.valueOf(Statistic_Seconds));
} }
/** Get Statistic Seconds. /** Get Statistic Seconds.
@return Internal statistics how many seconds a process took */ @return Internal statistics how many seconds a process took */

View File

@ -14,6 +14,7 @@
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html * * or via info@compiere.org or http://www.compiere.org/license.html *
* Contributor(s): Carlos Ruiz - globalqss * * Contributor(s): Carlos Ruiz - globalqss *
* Teo Sarca
*****************************************************************************/ *****************************************************************************/
package org.compiere.util; package org.compiere.util;
@ -32,6 +33,8 @@ import org.compiere.*;
* *
* globalqss - Grant independence to GenerateModel from AD_Table_ID * globalqss - Grant independence to GenerateModel from AD_Table_ID
* globalqss - Filter by table (LIKE) * globalqss - Filter by table (LIKE)
*
* globalqss - integrate Teo Sarca hint [ 1617928 ] Ineficient use of Boolean ctor for gen. model
*/ */
public class GenerateModel public class GenerateModel
{ {
@ -418,11 +421,11 @@ public class GenerateModel
sb.append("if (").append (columnName).append (" <= 0) ") sb.append("if (").append (columnName).append (" <= 0) ")
.append(setValue).append(" (\"").append(columnName).append("\", null); else \n"); .append(setValue).append(" (\"").append(columnName).append("\", null); else \n");
} }
sb.append(setValue).append(" (\"").append(columnName).append("\", new Integer(").append(columnName).append("));"); sb.append(setValue).append(" (\"").append(columnName).append("\", Integer.valueOf(").append(columnName).append("));");
} }
// Boolean // Boolean
else if (clazz.equals(Boolean.class)) else if (clazz.equals(Boolean.class))
sb.append(setValue).append(" (\"").append(columnName).append("\", new Boolean(").append(columnName).append("));"); sb.append(setValue).append(" (\"").append(columnName).append("\", Boolean.valueOf(").append(columnName).append("));");
else else
{ {
if (isMandatory && AD_Reference_ID == 0) // does not apply to int/boolean if (isMandatory && AD_Reference_ID == 0) // does not apply to int/boolean