Sunday, 11 February 2018

Rewritting in Customization


Quite often peple write redundant code

Example

MboSetRemote invoiceLineSet=invoice.getMboSet("invoiceline");
if(invoiceLine.isEmpty()){
MboRemote invoiceLineMbo=invoiceLineSet.moveFirst();
while (invoiceLineMbo!=null) {
Long constransId=invoiceLineMbo.getLong("CONSTRANSID");
if(constransId>0)
{
StringBuilder sb=new StringBuilder();
sb.append(String.ValueOf(constransId));

}

}



Here this line if(invoiceLine.isEmpty()){ is not nacessary because we are not taking string value of out of mboset or calling any moethod  from it

sb.append(String.ValueOf(constransId)); this is also not required because sb.append method can handle Long values.

No comments:

Post a Comment