com.algoTrader.vo.ib.OrderStatus.java Source code

Java tutorial

Introduction

Here is the source code for com.algoTrader.vo.ib.OrderStatus.java

Source

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

import java.io.Serializable;
import java.util.Arrays;
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 OrderStatus
 */
public class OrderStatus implements Serializable, Comparable<OrderStatus> {
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = -1723275599347524457L;

    // Class attributes
    /** TODO: Model Documentation for attribute orderId */
    protected int orderId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setOrderId = false;
    /** TODO: Model Documentation for attribute status */
    protected String status;
    /** TODO: Model Documentation for attribute filled */
    protected int filled;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setFilled = false;
    /** TODO: Model Documentation for attribute remaining */
    protected int remaining;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setRemaining = false;
    /** TODO: Model Documentation for attribute avgFillPrice */
    protected double avgFillPrice;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setAvgFillPrice = false;
    /** TODO: Model Documentation for attribute permId */
    protected int permId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setPermId = false;
    /** TODO: Model Documentation for attribute parentId */
    protected int parentId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setParentId = false;
    /** TODO: Model Documentation for attribute lastFillPrice */
    protected double lastFillPrice;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setLastFillPrice = false;
    /** TODO: Model Documentation for attribute clientId */
    protected int clientId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setClientId = false;
    /** TODO: Model Documentation for attribute whyHeld */
    protected String whyHeld;

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

    /**
     * Constructor with all properties
     * @param orderIdIn int
     * @param statusIn String
     * @param filledIn int
     * @param remainingIn int
     * @param avgFillPriceIn double
     * @param permIdIn int
     * @param parentIdIn int
     * @param lastFillPriceIn double
     * @param clientIdIn int
     * @param whyHeldIn String
     */
    public OrderStatus(final int orderIdIn, final String statusIn, final int filledIn, final int remainingIn,
            final double avgFillPriceIn, final int permIdIn, final int parentIdIn, final double lastFillPriceIn,
            final int clientIdIn, final String whyHeldIn) {
        this.orderId = orderIdIn;
        this.setOrderId = true;
        this.status = statusIn;
        this.filled = filledIn;
        this.setFilled = true;
        this.remaining = remainingIn;
        this.setRemaining = true;
        this.avgFillPrice = avgFillPriceIn;
        this.setAvgFillPrice = true;
        this.permId = permIdIn;
        this.setPermId = true;
        this.parentId = parentIdIn;
        this.setParentId = true;
        this.lastFillPrice = lastFillPriceIn;
        this.setLastFillPrice = true;
        this.clientId = clientIdIn;
        this.setClientId = true;
        this.whyHeld = whyHeldIn;
    }

    /**
     * Copies constructor from other OrderStatus
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public OrderStatus(final OrderStatus otherBean) {
        this.orderId = otherBean.getOrderId();
        this.setOrderId = true;
        this.status = otherBean.getStatus();
        this.filled = otherBean.getFilled();
        this.setFilled = true;
        this.remaining = otherBean.getRemaining();
        this.setRemaining = true;
        this.avgFillPrice = otherBean.getAvgFillPrice();
        this.setAvgFillPrice = true;
        this.permId = otherBean.getPermId();
        this.setPermId = true;
        this.parentId = otherBean.getParentId();
        this.setParentId = true;
        this.lastFillPrice = otherBean.getLastFillPrice();
        this.setLastFillPrice = true;
        this.clientId = otherBean.getClientId();
        this.setClientId = true;
        this.whyHeld = otherBean.getWhyHeld();
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final OrderStatus otherBean) {
        if (null != otherBean) {
            this.setOrderId(otherBean.getOrderId());
            this.setOrderId = true;
            this.setStatus(otherBean.getStatus());
            this.setFilled(otherBean.getFilled());
            this.setFilled = true;
            this.setRemaining(otherBean.getRemaining());
            this.setRemaining = true;
            this.setAvgFillPrice(otherBean.getAvgFillPrice());
            this.setAvgFillPrice = true;
            this.setPermId(otherBean.getPermId());
            this.setPermId = true;
            this.setParentId(otherBean.getParentId());
            this.setParentId = true;
            this.setLastFillPrice(otherBean.getLastFillPrice());
            this.setLastFillPrice = true;
            this.setClientId(otherBean.getClientId());
            this.setClientId = true;
            this.setWhyHeld(otherBean.getWhyHeld());
        }
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
     * TODO: Model Documentation for attribute avgFillPrice
     * Get the avgFillPrice Attribute
     * @return avgFillPrice double
     */
    public double getAvgFillPrice() {
        return this.avgFillPrice;
    }

    /**
     * 
     * @param value double
     */
    public void setAvgFillPrice(final double value) {
        this.avgFillPrice = value;
        this.setAvgFillPrice = true;
    }

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

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

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

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

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

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

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

    /**
     * TODO: Model Documentation for attribute lastFillPrice
     * Get the lastFillPrice Attribute
     * @return lastFillPrice double
     */
    public double getLastFillPrice() {
        return this.lastFillPrice;
    }

    /**
     * 
     * @param value double
     */
    public void setLastFillPrice(final double value) {
        this.lastFillPrice = value;
        this.setLastFillPrice = true;
    }

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

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

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

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

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

    /**
     * 
     * @param value String
     */
    public void setWhyHeld(final String value) {
        this.whyHeld = 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;
        }
        OrderStatus rhs = (OrderStatus) object;
        return new EqualsBuilder().append(this.getOrderId(), rhs.getOrderId())
                .append(this.getStatus(), rhs.getStatus()).append(this.getFilled(), rhs.getFilled())
                .append(this.getRemaining(), rhs.getRemaining())
                .append(this.getAvgFillPrice(), rhs.getAvgFillPrice()).append(this.getPermId(), rhs.getPermId())
                .append(this.getParentId(), rhs.getParentId())
                .append(this.getLastFillPrice(), rhs.getLastFillPrice())
                .append(this.getClientId(), rhs.getClientId()).append(this.getWhyHeld(), rhs.getWhyHeld())
                .isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final OrderStatus object) {
        if (object == null) {
            return -1;
        }
        // Check if the same object instance
        if (object == this) {
            return 0;
        }
        return new CompareToBuilder().append(this.getOrderId(), object.getOrderId())
                .append(this.getStatus(), object.getStatus()).append(this.getFilled(), object.getFilled())
                .append(this.getRemaining(), object.getRemaining())
                .append(this.getAvgFillPrice(), object.getAvgFillPrice())
                .append(this.getPermId(), object.getPermId()).append(this.getParentId(), object.getParentId())
                .append(this.getLastFillPrice(), object.getLastFillPrice())
                .append(this.getClientId(), object.getClientId()).append(this.getWhyHeld(), object.getWhyHeld())
                .toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(1249046965, -82296885).append(this.getOrderId()).append(this.getStatus())
                .append(this.getFilled()).append(this.getRemaining()).append(this.getAvgFillPrice())
                .append(this.getPermId()).append(this.getParentId()).append(this.getLastFillPrice())
                .append(this.getClientId()).append(this.getWhyHeld()).toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this).append("orderId", this.getOrderId()).append("status", this.getStatus())
                .append("filled", this.getFilled()).append("remaining", this.getRemaining())
                .append("avgFillPrice", this.getAvgFillPrice()).append("permId", this.getPermId())
                .append("parentId", this.getParentId()).append("lastFillPrice", this.getLastFillPrice())
                .append("clientId", this.getClientId()).append("whyHeld", this.getWhyHeld()).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 OrderStatus that = (OrderStatus) thatObject;

        return equal(this.getOrderId(), that.getOrderId()) && equal(this.getStatus(), that.getStatus())
                && equal(this.getFilled(), that.getFilled()) && equal(this.getRemaining(), that.getRemaining())
                && equal(this.getAvgFillPrice(), that.getAvgFillPrice())
                && equal(this.getPermId(), that.getPermId()) && equal(this.getParentId(), that.getParentId())
                && equal(this.getLastFillPrice(), that.getLastFillPrice())
                && equal(this.getClientId(), that.getClientId()) && equal(this.getWhyHeld(), that.getWhyHeld());
    }

    /**
     * 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;
    }

    // OrderStatus value-object java merge-point
}