/** * Creates a shallow copy of the given <code>QuoteBean</code>. * * @param inBean a <code>QuoteBean</code> value * @return a <code>QuoteBean</code> value */ public static QuoteBean copy(QuoteBean inBean) { QuoteBean newBean = new QuoteBean(); copyAttributes(inBean, newBean); return newBean; } /**
/** * Create a new QuoteEventImpl instance. * * @param inQuote a <code>QuoteBean</code> value * @throws IllegalArgumentException if <code>MessageId</code> < 0 * @throws IllegalArgumentException if <code>Timestamp</code> is <code>null</code> * @throws IllegalArgumentException if <code>Instrument</code> is <code>null</code> * @throws IllegalArgumentException if <code>Price</code> is <code>null</code> * @throws IllegalArgumentException if <code>Size</code> is <code>null</code> * @throws IllegalArgumentException if <code>Exchange</code> is <code>null</code> or empty * @throws IllegalArgumentException if <code>ExchangeTimestamp</code> is <code>null</code> or empty * @throws IllegalArgumentException if <code>Action</code> is <code>null</code> */ protected AbstractQuoteEventImpl(QuoteBean inQuote) { quote = QuoteBean.copy(inQuote); quote.setDefaults(); quote.validate(); } /**
/** * Copies all member attributes from the donor to the recipient. * * @param inDonor a <code>QuoteBean</code> value * @param inRecipient a <code>QuoteBean</code> value */ protected static void copyAttributes(QuoteBean inDonor, QuoteBean inRecipient) { MarketDataBean.copyAttributes(inDonor, inRecipient); inRecipient.setAction(inDonor.getAction()); inRecipient.setCount(inDonor.getCount()); inRecipient.setIsEmpty(inDonor.isEmpty()); inRecipient.setLevel(inDonor.getLevel()); } /**
throw new NullPointerException(); QuoteBean quote = new QuoteBean(); quote.setMessageId(inQuoteEvent.getMessageId()); quote.setTimestamp(inTimestamp); quote.setInstrument(inQuoteEvent.getInstrument()); quote.setExchange(inQuoteEvent.getExchange()); quote.setPrice(inQuoteEvent.getPrice()); quote.setProcessedTimestamp(inQuoteEvent.getProcessedTimestamp()); quote.setReceivedTimestamp(inQuoteEvent.getReceivedTimestamp()); quote.setSize(inSize); quote.setExchangeTimestamp(inQuoteEvent.getExchangeTimestamp()); quote.setAction(inQuoteAction); quote.setSource(inQuoteEvent.getSource()); quote.setEventType(inQuoteEvent.getEventType()); quote.setLevel(inQuoteEvent.getLevel()); quote.setCount(inQuoteEvent.getCount()); quote.setIsEmpty(inQuoteEvent.isEmpty()); return quote;
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("QuoteBean [").append(getMessageId()).append(' ').append(action).append(' ').append(getEventType()).append("]") .append(getInstrument()).append(' ').append(getExchange()).append(' ').append(getSize()).append('@').append(getPrice()); return builder.toString(); } /**
@Override public Instrument getInstrument() { return quote.getInstrument(); } /* (non-Javadoc)
@Override public int getCount() { return quote.getCount(); } /* (non-Javadoc)
@Override public EventType getEventType() { return quote.getEventType(); } /* (non-Javadoc)
@Override public String getExchange() { return quote.getExchange(); } /* (non-Javadoc)
@Override public Date getExchangeTimestamp() { return quote.getExchangeTimestamp(); } /* (non-Javadoc)
@Override public String getInstrumentAsString() { return quote.getInstrumentAsString(); } /* (non-Javadoc)
/** * Create a new AbstractQuoteEventImpl instance. * * <p>Intended to be used by JAXB only. */ protected AbstractQuoteEventImpl() { quote = new QuoteBean(); } /**
/** * Get the action value. * * @return a <code>QuoteAction</code> value */ public QuoteAction getAction() { return quote.getAction(); } /* (non-Javadoc)
@Override public AskEvent create() { if(getQuote().getInstrument() instanceof Equity) { return new EquityAskEventImpl(getQuote()); } throw new IllegalArgumentException(VALIDATION_EQUITY_REQUIRED.getText()); } };
@Override public BidEvent create() { if(getQuote().getInstrument() instanceof Equity) { return new EquityBidEventImpl(getQuote()); } throw new IllegalArgumentException(VALIDATION_EQUITY_REQUIRED.getText()); } };
@Override public AskEvent create() { if(getQuote().getInstrument() instanceof Future) { return new FutureAskEventImpl(getQuote(), getFuture()); } throw new IllegalArgumentException(VALIDATION_FUTURE_REQUIRED.getText()); } };
@Override public AskEvent create() { if(getQuote().getInstrument() instanceof Option) { return new OptionAskEventImpl(getQuote(), getOption()); } throw new IllegalArgumentException(VALIDATION_OPTION_REQUIRED.getText()); } };
@Override public BidEvent create() { if(getQuote().getInstrument() instanceof Option) { return new OptionBidEventImpl(getQuote(), getOption()); } throw new IllegalArgumentException(VALIDATION_OPTION_REQUIRED.getText()); } };
@Override public BidEvent create() { if(getQuote().getInstrument() instanceof Currency) { return new CurrencyBidEventImpl(getQuote(), getCurrency()); } throw new IllegalArgumentException(VALIDATION_CURRENCY_REQUIRED.getText()); } };
@Override public BidEvent create() { if(getQuote().getInstrument() instanceof ConvertibleBond) { return new ConvertibleBondBidEventImpl(getQuote(), getConvertibleBond()); } throw new IllegalArgumentException(VALIDATION_BOND_REQUIRED.getText()); } };