We currently have the following compound if statement...
if ((billingRemoteService == null)
|| billingRemoteService.getServiceHeader() == null
|| !\"
As others have stated, exceptions are more expensive than if statements. However, there is an excellent reason not to use them in your case.
Exceptions are for exceptional events
When unpacking a message, something not being in the message is expected error checking, not an exceptional event.
This block of code is far too interested in the data in other instances. Add some behavior to those other instances. Right now all of the behavior is in the code that is not in the class, which is bad object orientation.
-- for billingRemoteService --
public boolean hasResponse();
public BillingRemoteResponse getResponse();
-- for BillingRemoteResponse --
public List getCustomerList();
-- for Customer --
public Customer(Long ecpdId, ...) {
if (ecpdId == null) throw new IllegalArgumentException(...);
}