com.algoTrader.vo.RawTickVO.java Source code

Java tutorial

Introduction

Here is the source code for com.algoTrader.vo.RawTickVO.java

Source

// license-header java merge-point
//
/**
 * @author Generated on 02/10/2014 17:30:58+0000 Do not modify by hand!
 *
 * TEMPLATE:     ValueObject.vsl in andromda-java-cartridge.
 * MODEL CLASS:  Data::AlgoTrader::com.algoTrader::vo::RawTickVO
 * STEREOTYPE:   ValueObject
 */
package com.algoTrader.vo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * TODO: Model Documentation for class RawTickVO
 */
public class RawTickVO implements Serializable, Comparable<RawTickVO> {
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = 2973772054622564150L;

    // Class attributes
    /** TODO: Model Documentation for attribute isin */
    protected String isin;
    /** TODO: Model Documentation for attribute dateTime */
    protected Date dateTime;
    /** TODO: Model Documentation for attribute last */
    protected BigDecimal last;
    /** TODO: Model Documentation for attribute lastDateTime */
    protected Date lastDateTime;
    /** TODO: Model Documentation for attribute vol */
    protected int vol;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setVol = false;
    /** TODO: Model Documentation for attribute volBid */
    protected int volBid;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setVolBid = false;
    /** TODO: Model Documentation for attribute volAsk */
    protected int volAsk;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setVolAsk = false;
    /** TODO: Model Documentation for attribute bid */
    protected BigDecimal bid;
    /** TODO: Model Documentation for attribute midpoint */
    protected BigDecimal midpoint;
    /** TODO: Model Documentation for attribute ask */
    protected BigDecimal ask;
    /** TODO: Model Documentation for attribute openIntrest */
    protected int openIntrest;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setOpenIntrest = false;
    /** TODO: Model Documentation for attribute settlement */
    protected BigDecimal settlement;

    /** Default Constructor with no properties */
    public RawTickVO() {
        // Documented empty block - avoid compiler warning - no super constructor
    }

    /**
     * Constructor taking only required properties
     * @param isinIn String
     * @param dateTimeIn Date
     * @param volIn int
     * @param volBidIn int
     * @param volAskIn int
     * @param openIntrestIn int
     */
    public RawTickVO(final String isinIn, final Date dateTimeIn, final int volIn, final int volBidIn,
            final int volAskIn, final int openIntrestIn) {
        this.isin = isinIn;
        this.dateTime = dateTimeIn;
        this.vol = volIn;
        this.setVol = true;
        this.volBid = volBidIn;
        this.setVolBid = true;
        this.volAsk = volAskIn;
        this.setVolAsk = true;
        this.openIntrest = openIntrestIn;
        this.setOpenIntrest = true;
    }

    /**
     * Constructor with all properties
     * @param isinIn String
     * @param dateTimeIn Date
     * @param lastIn BigDecimal
     * @param lastDateTimeIn Date
     * @param volIn int
     * @param volBidIn int
     * @param volAskIn int
     * @param bidIn BigDecimal
     * @param midpointIn BigDecimal
     * @param askIn BigDecimal
     * @param openIntrestIn int
     * @param settlementIn BigDecimal
     */
    public RawTickVO(final String isinIn, final Date dateTimeIn, final BigDecimal lastIn, final Date lastDateTimeIn,
            final int volIn, final int volBidIn, final int volAskIn, final BigDecimal bidIn,
            final BigDecimal midpointIn, final BigDecimal askIn, final int openIntrestIn,
            final BigDecimal settlementIn) {
        this.isin = isinIn;
        this.dateTime = dateTimeIn;
        this.last = lastIn;
        this.lastDateTime = lastDateTimeIn;
        this.vol = volIn;
        this.setVol = true;
        this.volBid = volBidIn;
        this.setVolBid = true;
        this.volAsk = volAskIn;
        this.setVolAsk = true;
        this.bid = bidIn;
        this.midpoint = midpointIn;
        this.ask = askIn;
        this.openIntrest = openIntrestIn;
        this.setOpenIntrest = true;
        this.settlement = settlementIn;
    }

    /**
     * Copies constructor from other RawTickVO
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public RawTickVO(final RawTickVO otherBean) {
        this.isin = otherBean.getIsin();
        this.dateTime = otherBean.getDateTime();
        this.last = otherBean.getLast();
        this.lastDateTime = otherBean.getLastDateTime();
        this.vol = otherBean.getVol();
        this.setVol = true;
        this.volBid = otherBean.getVolBid();
        this.setVolBid = true;
        this.volAsk = otherBean.getVolAsk();
        this.setVolAsk = true;
        this.bid = otherBean.getBid();
        this.midpoint = otherBean.getMidpoint();
        this.ask = otherBean.getAsk();
        this.openIntrest = otherBean.getOpenIntrest();
        this.setOpenIntrest = true;
        this.settlement = otherBean.getSettlement();
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final RawTickVO otherBean) {
        if (null != otherBean) {
            this.setIsin(otherBean.getIsin());
            this.setDateTime(otherBean.getDateTime());
            this.setLast(otherBean.getLast());
            this.setLastDateTime(otherBean.getLastDateTime());
            this.setVol(otherBean.getVol());
            this.setVol = true;
            this.setVolBid(otherBean.getVolBid());
            this.setVolBid = true;
            this.setVolAsk(otherBean.getVolAsk());
            this.setVolAsk = true;
            this.setBid(otherBean.getBid());
            this.setMidpoint(otherBean.getMidpoint());
            this.setAsk(otherBean.getAsk());
            this.setOpenIntrest(otherBean.getOpenIntrest());
            this.setOpenIntrest = true;
            this.setSettlement(otherBean.getSettlement());
        }
    }

    /**
     * TODO: Model Documentation for attribute isin
     * Get the isin Attribute
     * @return isin String
     */
    public String getIsin() {
        return this.isin;
    }

    /**
     * 
     * @param value String
     */
    public void setIsin(final String value) {
        this.isin = value;
    }

    /**
     * TODO: Model Documentation for attribute dateTime
     * Get the dateTime Attribute
     * @return dateTime Date
     */
    public Date getDateTime() {
        return this.dateTime;
    }

    /**
     * 
     * @param value Date
     */
    public void setDateTime(final Date value) {
        this.dateTime = value;
    }

    /**
     * TODO: Model Documentation for attribute last
     * Get the last Attribute
     * @return last BigDecimal
     */
    public BigDecimal getLast() {
        return this.last;
    }

    /**
     * 
     * @param value BigDecimal
     */
    public void setLast(final BigDecimal value) {
        this.last = value;
    }

    /**
     * TODO: Model Documentation for attribute lastDateTime
     * Get the lastDateTime Attribute
     * @return lastDateTime Date
     */
    public Date getLastDateTime() {
        return this.lastDateTime;
    }

    /**
     * 
     * @param value Date
     */
    public void setLastDateTime(final Date value) {
        this.lastDateTime = value;
    }

    /**
     * TODO: Model Documentation for attribute vol
     * Get the vol Attribute
     * @return vol int
     */
    public int getVol() {
        return this.vol;
    }

    /**
     * 
     * @param value int
     */
    public void setVol(final int value) {
        this.vol = value;
        this.setVol = true;
    }

    /**
     * Return true if the primitive attribute vol is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetVol() {
        return this.setVol;
    }

    /**
     * TODO: Model Documentation for attribute volBid
     * Get the volBid Attribute
     * @return volBid int
     */
    public int getVolBid() {
        return this.volBid;
    }

    /**
     * 
     * @param value int
     */
    public void setVolBid(final int value) {
        this.volBid = value;
        this.setVolBid = true;
    }

    /**
     * Return true if the primitive attribute volBid is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetVolBid() {
        return this.setVolBid;
    }

    /**
     * TODO: Model Documentation for attribute volAsk
     * Get the volAsk Attribute
     * @return volAsk int
     */
    public int getVolAsk() {
        return this.volAsk;
    }

    /**
     * 
     * @param value int
     */
    public void setVolAsk(final int value) {
        this.volAsk = value;
        this.setVolAsk = true;
    }

    /**
     * Return true if the primitive attribute volAsk is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetVolAsk() {
        return this.setVolAsk;
    }

    /**
     * TODO: Model Documentation for attribute bid
     * Get the bid Attribute
     * @return bid BigDecimal
     */
    public BigDecimal getBid() {
        return this.bid;
    }

    /**
     * 
     * @param value BigDecimal
     */
    public void setBid(final BigDecimal value) {
        this.bid = value;
    }

    /**
     * TODO: Model Documentation for attribute midpoint
     * Get the midpoint Attribute
     * @return midpoint BigDecimal
     */
    public BigDecimal getMidpoint() {
        return this.midpoint;
    }

    /**
     * 
     * @param value BigDecimal
     */
    public void setMidpoint(final BigDecimal value) {
        this.midpoint = value;
    }

    /**
     * TODO: Model Documentation for attribute ask
     * Get the ask Attribute
     * @return ask BigDecimal
     */
    public BigDecimal getAsk() {
        return this.ask;
    }

    /**
     * 
     * @param value BigDecimal
     */
    public void setAsk(final BigDecimal value) {
        this.ask = value;
    }

    /**
     * TODO: Model Documentation for attribute openIntrest
     * Get the openIntrest Attribute
     * @return openIntrest int
     */
    public int getOpenIntrest() {
        return this.openIntrest;
    }

    /**
     * 
     * @param value int
     */
    public void setOpenIntrest(final int value) {
        this.openIntrest = value;
        this.setOpenIntrest = true;
    }

    /**
     * Return true if the primitive attribute openIntrest is set, through the setter or constructor
     * @return true if the attribute value has been set
     */
    public boolean isSetOpenIntrest() {
        return this.setOpenIntrest;
    }

    /**
     * TODO: Model Documentation for attribute settlement
     * Get the settlement Attribute
     * @return settlement BigDecimal
     */
    public BigDecimal getSettlement() {
        return this.settlement;
    }

    /**
     * 
     * @param value BigDecimal
     */
    public void setSettlement(final BigDecimal value) {
        this.settlement = value;
    }

    /**
     * @param object to compare this object against
     * @return boolean if equal
     * @see Object#equals(Object)
     */
    @Override
    public boolean equals(final Object object) {
        if (object == null || object.getClass() != this.getClass()) {
            return false;
        }
        // Check if the same object instance
        if (object == this) {
            return true;
        }
        RawTickVO rhs = (RawTickVO) object;
        return new EqualsBuilder().append(this.getIsin(), rhs.getIsin())
                .append(this.getDateTime(), rhs.getDateTime()).append(this.getLast(), rhs.getLast())
                .append(this.getLastDateTime(), rhs.getLastDateTime()).append(this.getVol(), rhs.getVol())
                .append(this.getVolBid(), rhs.getVolBid()).append(this.getVolAsk(), rhs.getVolAsk())
                .append(this.getBid(), rhs.getBid()).append(this.getMidpoint(), rhs.getMidpoint())
                .append(this.getAsk(), rhs.getAsk()).append(this.getOpenIntrest(), rhs.getOpenIntrest())
                .append(this.getSettlement(), rhs.getSettlement()).isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final RawTickVO object) {
        if (object == null) {
            return -1;
        }
        // Check if the same object instance
        if (object == this) {
            return 0;
        }
        return new CompareToBuilder().append(this.getIsin(), object.getIsin())
                .append(this.getDateTime(), object.getDateTime()).append(this.getLast(), object.getLast())
                .append(this.getLastDateTime(), object.getLastDateTime()).append(this.getVol(), object.getVol())
                .append(this.getVolBid(), object.getVolBid()).append(this.getVolAsk(), object.getVolAsk())
                .append(this.getBid(), object.getBid()).append(this.getMidpoint(), object.getMidpoint())
                .append(this.getAsk(), object.getAsk()).append(this.getOpenIntrest(), object.getOpenIntrest())
                .append(this.getSettlement(), object.getSettlement()).toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(1249046965, -82296885).append(this.getIsin()).append(this.getDateTime())
                .append(this.getLast()).append(this.getLastDateTime()).append(this.getVol())
                .append(this.getVolBid()).append(this.getVolAsk()).append(this.getBid()).append(this.getMidpoint())
                .append(this.getAsk()).append(this.getOpenIntrest()).append(this.getSettlement()).toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this).append("isin", this.getIsin()).append("dateTime", this.getDateTime())
                .append("last", this.getLast()).append("lastDateTime", this.getLastDateTime())
                .append("vol", this.getVol()).append("volBid", this.getVolBid()).append("volAsk", this.getVolAsk())
                .append("bid", this.getBid()).append("midpoint", this.getMidpoint()).append("ask", this.getAsk())
                .append("openIntrest", this.getOpenIntrest()).append("settlement", this.getSettlement()).toString();
    }

    /**
     * Compares the properties of this instance to the properties of the argument. This method will return
     * {@code false} as soon as it detects that the argument is {@code null} or not of the same type as
     * (or a sub-type of) this instance's type.
     *
     * <p/>For array, collection or map properties the comparison will be done one level deep, in other words:
     * the elements will be compared using the {@code equals()} operation.
     *
     * <p/>Note that two properties will be considered equal when both values are {@code null}.
     *
     * @param thatObject the object containing the properties to compare against this instance
     * @return this method will return {@code true} in case the argument has the same type as this class, or is a
     *      sub-type of this class and all properties as found on this class have equal values when queried on that
     *      argument instance; in all other cases this method will return {@code false}
     */
    public boolean equalProperties(final Object thatObject) {
        if (thatObject == null || !this.getClass().isAssignableFrom(thatObject.getClass())) {
            return false;
        }

        final RawTickVO that = (RawTickVO) thatObject;

        return equal(this.getIsin(), that.getIsin()) && equal(this.getDateTime(), that.getDateTime())
                && equal(this.getLast(), that.getLast()) && equal(this.getLastDateTime(), that.getLastDateTime())
                && equal(this.getVol(), that.getVol()) && equal(this.getVolBid(), that.getVolBid())
                && equal(this.getVolAsk(), that.getVolAsk()) && equal(this.getBid(), that.getBid())
                && equal(this.getMidpoint(), that.getMidpoint()) && equal(this.getAsk(), that.getAsk())
                && equal(this.getOpenIntrest(), that.getOpenIntrest())
                && equal(this.getSettlement(), that.getSettlement());
    }

    /**
     * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
     * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
     * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
     *
     * <p/>Note that for array, collection or map instances the comparison runs one level deep.
     *
     * @param first the first object to compare, may be {@code null}
     * @param second the second object to compare, may be {@code null}
     * @return this method will return {@code true} in case both objects are equal as explained above;
     *      in all other cases this method will return {@code false}
     */
    protected static boolean equal(final Object first, final Object second) {
        final boolean equal;

        if (first == null) {
            equal = (second == null);
        } else if (first.getClass().isArray() && (second != null) && second.getClass().isArray()) {
            equal = Arrays.equals((Object[]) first, (Object[]) second);
        } else // note that the following also covers java.util.Collection and java.util.Map
        {
            equal = first.equals(second);
        }

        return equal;
    }

    // RawTickVO value-object java merge-point
}