001 /**
002 * Copyright 2007 Mike Kroutikov.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the Lesser GNU General Public License as
006 * published by the Free Software Foundation; either version 3 of
007 * the License, or (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 * Lesser GNU General Public License for more details.
013 *
014 * You should have received a copy of the Lesser GNU General Public License
015 * along with this program. If not, see <http://www.gnu.org/licenses/>.
016 */
017
018 package org.otfeed.command;
019
020 import java.util.Date;
021
022 import org.otfeed.event.IDataDelegate;
023 import org.otfeed.event.OTDividend;
024 import org.otfeed.protocol.ICommand;
025
026 /**
027 * Requests dividend info.
028 * <p/>
029 * Generates {@link OTDividend dividend} events.
030 */
031 public final class DividendsCommand
032 extends ExchangeSymbolAndDatesHolder implements ICommand {
033
034 /**
035 * Creates new dividends command, initializing
036 * all its properties.
037 *
038 * @param exchangeCode exchange code.
039 * @param symbolCode symbol code.
040 * @param startDate start date.
041 * @param endDate end date.
042 * @param dataDelegate data delegate.
043 */
044 public DividendsCommand(String exchangeCode,
045 String symbolCode,
046 Date startDate,
047 Date endDate,
048 IDataDelegate<OTDividend> dataDelegate) {
049 setExchangeCode(exchangeCode);
050 setSymbolCode(symbolCode);
051 setStartDate(startDate);
052 setEndDate(endDate);
053 setDataDelegate(dataDelegate);
054 }
055
056 /**
057 * Default constructor. All properties must
058 * be initialized
059 * explicitly before using this command object.
060 */
061 public DividendsCommand() {
062 this(null, null, null, null, null);
063 }
064
065 private IDataDelegate<OTDividend> dataDelegate;
066
067 /**
068 * Delegate to receive {@link OTDividend} events.
069 * This parameter is mandatory.
070 *
071 * @return delegate.
072 */
073 public IDataDelegate<OTDividend> getDataDelegate() {
074 return dataDelegate;
075 }
076
077 /**
078 * Sets delegate.
079 *
080 * @param dataDelegate delegate.
081 */
082 public void setDataDelegate(IDataDelegate<OTDividend> dataDelegate) {
083 this.dataDelegate = dataDelegate;
084 }
085 }