/** * Returns whether it has the date at which the transaction occurred. * * @return whether it has the date at which the transaction occurred */ public boolean hasDate() { return getDate() != null; }
/** * Returns the commission for the transaction. * * @return commission for the transaction */ public Commission getCommission() { return getExtension(Commission.class); }
/** * Returns whether it has the notes. * * @return whether it has the notes */ public boolean hasNotes() { return getNotes() != null; }
/** * Sets the price of the transaction. * * @param price price of the transaction or <code>null</code> to reset */ public void setPrice(Price price) { if (price == null) { removeExtension(Price.class); } else { setExtension(price); } }
String notes) { TransactionEntry entry = new TransactionEntry(); TransactionData data = new TransactionData(); if (type.equals("")) type = "Buy"; data.setType(type); if (!date.equals("")) data.setDate(DateTime.parseDateTime(date + "T00:00:00.000Z")); if (!shares.equals("")) data.setShares(Double.valueOf(shares).doubleValue()); if (!price.equals("")) { Price p = new Price(); p.addMoney(new Money(Double.valueOf(price).doubleValue(), currency)); data.setPrice(p); data.setCommission(c); if (!notes.equals("")) data.setNotes(notes); entry.setTransactionData(data); return entry;
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(TransactionEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(TransactionEntry.class, TransactionData.getDefaultDescription(true, false)); new TransactionData().declareExtensions(extProfile); }
/** * Returns whether it has the commission for the transaction. * * @return whether it has the commission for the transaction */ public boolean hasCommission() { return hasExtension(Commission.class); }
/** * Returns whether it has the number of shares involved in the transaction. * * @return whether it has the number of shares involved in the transaction */ public boolean hasShares() { return getShares() != null; }
/** * Returns whether it has the type for the transaction (can be "Buy", "Sell", * "Buy to Cover" or "Sell Short"). * * @return whether it has the type for the transaction (can be "Buy", "Sell", * "Buy to Cover" or "Sell Short") */ public boolean hasType() { return getType() != null; }
String notes) { TransactionEntry entry = new TransactionEntry(); TransactionData data = new TransactionData(); if (type.equals("")) type = "Buy"; data.setType(type); if (!date.equals("")) data.setDate(DateTime.parseDateTime(date + "T00:00:00.000Z")); if (!shares.equals("")) data.setShares(Double.valueOf(shares).doubleValue()); if (!price.equals("")) { Price p = new Price(); p.addMoney(new Money(Double.valueOf(price).doubleValue(), currency)); data.setPrice(p); data.setCommission(c); if (!notes.equals("")) data.setNotes(notes); entry.setTransactionData(data); return entry;
@Override public void declareExtensions(ExtensionProfile extProfile) { if (extProfile.isDeclared(TransactionEntry.class)) { return; } super.declareExtensions(extProfile); extProfile.declare(TransactionEntry.class, TransactionData.getDefaultDescription(true, false)); new TransactionData().declareExtensions(extProfile); }
/** * Sets the price of the transaction. * * @param price price of the transaction or <code>null</code> to reset */ public void setPrice(Price price) { if (price == null) { removeExtension(Price.class); } else { setExtension(price); } }
/** * Returns whether it has the commission for the transaction. * * @return whether it has the commission for the transaction */ public boolean hasCommission() { return hasExtension(Commission.class); }
/** * Returns whether it has the number of shares involved in the transaction. * * @return whether it has the number of shares involved in the transaction */ public boolean hasShares() { return getShares() != null; }
/** * Returns whether it has the type for the transaction (can be "Buy", "Sell", * "Buy to Cover" or "Sell Short"). * * @return whether it has the type for the transaction (can be "Buy", "Sell", * "Buy to Cover" or "Sell Short") */ public boolean hasType() { return getType() != null; }
/** * Sets the commission for the transaction. * * @param commission commission for the transaction or <code>null</code> to * reset */ public void setCommission(Commission commission) { if (commission == null) { removeExtension(Commission.class); } else { setExtension(commission); } }
/** * Returns whether it has the price of the transaction. * * @return whether it has the price of the transaction */ public boolean hasPrice() { return hasExtension(Price.class); }
/** * Returns the price of the transaction. * * @return price of the transaction */ public Price getPrice() { return getExtension(Price.class); }
/** * Returns whether it has the date at which the transaction occurred. * * @return whether it has the date at which the transaction occurred */ public boolean hasDate() { return getDate() != null; }
/** * Returns whether it has the notes. * * @return whether it has the notes */ public boolean hasNotes() { return getNotes() != null; }