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

Java tutorial

Introduction

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

Source

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

import com.ib.client.ContractDetails;
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 ScannerData
 */
public class ScannerData implements Serializable, Comparable<ScannerData> {
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = -949679910325820721L;

    // Class attributes
    /** TODO: Model Documentation for attribute reqId */
    protected int reqId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setReqId = false;
    /** TODO: Model Documentation for attribute rank */
    protected int rank;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setRank = false;
    /** TODO: Model Documentation for attribute contractDetails */
    protected ContractDetails contractDetails;
    /** TODO: Model Documentation for attribute distance */
    protected String distance;
    /** TODO: Model Documentation for attribute benchmark */
    protected String benchmark;
    /** TODO: Model Documentation for attribute projection */
    protected String projection;
    /** TODO: Model Documentation for attribute legsStr */
    protected String legsStr;

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

    /**
     * Constructor with all properties
     * @param reqIdIn int
     * @param rankIn int
     * @param contractDetailsIn ContractDetails
     * @param distanceIn String
     * @param benchmarkIn String
     * @param projectionIn String
     * @param legsStrIn String
     */
    public ScannerData(final int reqIdIn, final int rankIn, final ContractDetails contractDetailsIn,
            final String distanceIn, final String benchmarkIn, final String projectionIn, final String legsStrIn) {
        this.reqId = reqIdIn;
        this.setReqId = true;
        this.rank = rankIn;
        this.setRank = true;
        this.contractDetails = contractDetailsIn;
        this.distance = distanceIn;
        this.benchmark = benchmarkIn;
        this.projection = projectionIn;
        this.legsStr = legsStrIn;
    }

    /**
     * Copies constructor from other ScannerData
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public ScannerData(final ScannerData otherBean) {
        this.reqId = otherBean.getReqId();
        this.setReqId = true;
        this.rank = otherBean.getRank();
        this.setRank = true;
        this.contractDetails = otherBean.getContractDetails();
        this.distance = otherBean.getDistance();
        this.benchmark = otherBean.getBenchmark();
        this.projection = otherBean.getProjection();
        this.legsStr = otherBean.getLegsStr();
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final ScannerData otherBean) {
        if (null != otherBean) {
            this.setReqId(otherBean.getReqId());
            this.setReqId = true;
            this.setRank(otherBean.getRank());
            this.setRank = true;
            this.setContractDetails(otherBean.getContractDetails());
            this.setDistance(otherBean.getDistance());
            this.setBenchmark(otherBean.getBenchmark());
            this.setProjection(otherBean.getProjection());
            this.setLegsStr(otherBean.getLegsStr());
        }
    }

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

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

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

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

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

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

    /**
     * TODO: Model Documentation for attribute contractDetails
     * Get the contractDetails Attribute
     * @return contractDetails ContractDetails
     */
    public ContractDetails getContractDetails() {
        return this.contractDetails;
    }

    /**
     * 
     * @param value ContractDetails
     */
    public void setContractDetails(final ContractDetails value) {
        this.contractDetails = value;
    }

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

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

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

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

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

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

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

    /**
     * 
     * @param value String
     */
    public void setLegsStr(final String value) {
        this.legsStr = 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;
        }
        ScannerData rhs = (ScannerData) object;
        return new EqualsBuilder().append(this.getReqId(), rhs.getReqId()).append(this.getRank(), rhs.getRank())
                .append(this.getContractDetails(), rhs.getContractDetails())
                .append(this.getDistance(), rhs.getDistance()).append(this.getBenchmark(), rhs.getBenchmark())
                .append(this.getProjection(), rhs.getProjection()).append(this.getLegsStr(), rhs.getLegsStr())
                .isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final ScannerData object) {
        if (object == null) {
            return -1;
        }
        // Check if the same object instance
        if (object == this) {
            return 0;
        }
        return new CompareToBuilder().append(this.getReqId(), object.getReqId())
                .append(this.getRank(), object.getRank())
                .append(this.getContractDetails(), object.getContractDetails())
                .append(this.getDistance(), object.getDistance()).append(this.getBenchmark(), object.getBenchmark())
                .append(this.getProjection(), object.getProjection()).append(this.getLegsStr(), object.getLegsStr())
                .toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(1249046965, -82296885).append(this.getReqId()).append(this.getRank())
                .append(this.getContractDetails()).append(this.getDistance()).append(this.getBenchmark())
                .append(this.getProjection()).append(this.getLegsStr()).toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this).append("reqId", this.getReqId()).append("rank", this.getRank())
                .append("contractDetails", this.getContractDetails()).append("distance", this.getDistance())
                .append("benchmark", this.getBenchmark()).append("projection", this.getProjection())
                .append("legsStr", this.getLegsStr()).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 ScannerData that = (ScannerData) thatObject;

        return equal(this.getReqId(), that.getReqId()) && equal(this.getRank(), that.getRank())
                && equal(this.getContractDetails(), that.getContractDetails())
                && equal(this.getDistance(), that.getDistance()) && equal(this.getBenchmark(), that.getBenchmark())
                && equal(this.getProjection(), that.getProjection()) && equal(this.getLegsStr(), that.getLegsStr());
    }

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

    // ScannerData value-object java merge-point
}