/** * Prints detailed contents for a transaction (i.e. a Transaction Feed entry) * * @param transactionEntry The transaction entry of interest */ private static void printTransactionEntry(TransactionEntry transactionEntry) { System.out.println("\nTransaction Entry\n-----------------"); printBasicEntryDetails(transactionEntry); TransactionData transactionData = transactionEntry.getTransactionData(); System.out.println("\tTransaction Data:"); System.out.println( "\t\tType: " + (transactionData.getType() == null ? "no type" : transactionData.getType())); System.out.println( "\t\tDate: " + (transactionData.getDate() == null ? "no date" : transactionData.getDate())); System.out.printf("\t\tShares: %.2f\n", transactionData.getShares()); if (transactionData.getPrice() == null) { System.out.println("\t\tPrice not specified"); } else { for (int i = 0; i < transactionData.getPrice().getMoney().size(); i++) { Money m = transactionData.getPrice().getMoney().get(i); System.out.printf( "\t\tThis transaction had a unit price of %.2f %s.\n", m.getAmount(), m.getCurrencyCode()); } } if (transactionData.getCommission() == null) { System.out.println("\t\tCommission not specified"); } else { for (int i = 0; i < transactionData.getCommission().getMoney().size(); i++) { Money m = transactionData.getCommission().getMoney().get(i); System.out.printf( "\t\tThis transaction had a commission of %.2f %s.\n", m.getAmount(), m.getCurrencyCode()); } } System.out.println( "\t\tNotes: " + (null == transactionData.getNotes() ? "none" : transactionData.getNotes())); }