title: Null empty check for Custom Object in Java
body: <p>I am having below null check
  Amount is having below fields</p>
  
  <pre><code>Amount{
    Money amountToBePaid;
    Float percentage;
  }
  </code></pre>
  
  <p>and Money is having below fields:</p>
  
  <pre><code>Money {
  
    String unit;
    BigDecimal value
  }
  
  
  private boolean checkIfAmountDefined(Amount amount){
    amountFlag=false;
    If (null != amount || !ObjectUtils.isEmpty(amount)) {
      if (!ObjectUtils.isEmpty(amount.getAmountToBePaid())&amp;&amp; 
         !ObjectUtils.isEmpty(amount.getPercentage())) {
        if (!ObjectUtils.isEmpty(amount.getAmountToBePaid().getValue()) || 
          !ObjectUtils.isEmpty(amount.getAmountToBePaid().getUnit())) {
          amountFlag = true;
          return amountFlag;
        }
      }
  }
  return amountFlag;
  }
  </code></pre>
  
  <p>I need to check if the amount is not defined for which I am running below c    check .The issue is I am getting null pointer exception for somtimes with percentage ,sometimes with other field. I can not ignore any of the inner fields as based upon these field I will consider the Amount is defined or not. Any suggestion ?</p>