I have this pojo of which there is a list is created below is shown as pojo
public class BrokerInvoiceLineItem {
private Date dealDate;
private String brokerRefId;
private String receiverName;
private double notional;
private double fixedRate;
private Date maturityDate;
private double amount;
}
below is the list which is of above pojo type
List<BrokerInvoiceLineItem> finalBrokerInvoiceLineItemList
now below is the method in which we are fetching the data and storing it to the list finally which we created above
finalBrokerInvoiceLineItemList = brokerInvoice.getLineItems();
now in this list when I inspect while debuging , i get the value of all the attributes at particular index .
now what I am trying to say that lets say at first index the attributes are there mentioned above now lets say if any attribute value lets say if deal date is coming as null at any index then i want to throw exception or lets say brokerRefID is coming as null i want to throw an excpetion so in similiar fashion while iterating over the list at each index i want to check the value of all the 7 attributes that is dealDate, brokerRefId,receiverName,notional,fixedRate,maturityDate,amount , so in the list while iterating if any of the attributes value stored at each index is coming as null i want to throw the exception
so please advise how would I iterate finalBrokerInvoiceLineItemList and check at each index the value of the above total 7 parameters that is whether theere value is null in the finalBrokerInvoiceLineItemList abd if it null then i should throw the exception
what i have tried is shown below is
for(BrokerInvoiceLineItem item : brokerInvoice.getLineItems()) {
if(item.getDealDate() == null)
throw Exception();
}
but the above one is only for one attribute only not all the seven attributes