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

Java tutorial

Introduction

Here is the source code for com.algoTrader.vo.ib.UpdateNewsBulletin.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::UpdateNewsBulletin
 * 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 UpdateNewsBulletin
 */
public class UpdateNewsBulletin implements Serializable, Comparable<UpdateNewsBulletin> {
    /** The serial version UID of this class. Needed for serialization. */
    private static final long serialVersionUID = -8242838827422509601L;

    // Class attributes
    /** TODO: Model Documentation for attribute msgId */
    protected int msgId;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setMsgId = false;
    /** TODO: Model Documentation for attribute msgType */
    protected int msgType;
    /**
     * boolean setter for primitive attribute, so we can tell if it's initialized
     */
    protected boolean setMsgType = false;
    /** TODO: Model Documentation for attribute message */
    protected String message;
    /** TODO: Model Documentation for attribute origExchange */
    protected String origExchange;

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

    /**
     * Constructor with all properties
     * @param msgIdIn int
     * @param msgTypeIn int
     * @param messageIn String
     * @param origExchangeIn String
     */
    public UpdateNewsBulletin(final int msgIdIn, final int msgTypeIn, final String messageIn,
            final String origExchangeIn) {
        this.msgId = msgIdIn;
        this.setMsgId = true;
        this.msgType = msgTypeIn;
        this.setMsgType = true;
        this.message = messageIn;
        this.origExchange = origExchangeIn;
    }

    /**
     * Copies constructor from other UpdateNewsBulletin
     *
     * @param otherBean Cannot be <code>null</code>
     * @throws NullPointerException if the argument is <code>null</code>
     */
    public UpdateNewsBulletin(final UpdateNewsBulletin otherBean) {
        this.msgId = otherBean.getMsgId();
        this.setMsgId = true;
        this.msgType = otherBean.getMsgType();
        this.setMsgType = true;
        this.message = otherBean.getMessage();
        this.origExchange = otherBean.getOrigExchange();
    }

    /**
     * Copies all properties from the argument value object into this value object.
     * @param otherBean Cannot be <code>null</code>
     */
    public void copy(final UpdateNewsBulletin otherBean) {
        if (null != otherBean) {
            this.setMsgId(otherBean.getMsgId());
            this.setMsgId = true;
            this.setMsgType(otherBean.getMsgType());
            this.setMsgType = true;
            this.setMessage(otherBean.getMessage());
            this.setOrigExchange(otherBean.getOrigExchange());
        }
    }

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

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

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

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

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

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

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

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

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

    /**
     * 
     * @param value String
     */
    public void setOrigExchange(final String value) {
        this.origExchange = 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;
        }
        UpdateNewsBulletin rhs = (UpdateNewsBulletin) object;
        return new EqualsBuilder().append(this.getMsgId(), rhs.getMsgId())
                .append(this.getMsgType(), rhs.getMsgType()).append(this.getMessage(), rhs.getMessage())
                .append(this.getOrigExchange(), rhs.getOrigExchange()).isEquals();
    }

    /**
     * @param object to compare this object against
     * @return int if equal
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(final UpdateNewsBulletin object) {
        if (object == null) {
            return -1;
        }
        // Check if the same object instance
        if (object == this) {
            return 0;
        }
        return new CompareToBuilder().append(this.getMsgId(), object.getMsgId())
                .append(this.getMsgType(), object.getMsgType()).append(this.getMessage(), object.getMessage())
                .append(this.getOrigExchange(), object.getOrigExchange()).toComparison();
    }

    /**
     * @return int hashCode value
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(1249046965, -82296885).append(this.getMsgId()).append(this.getMsgType())
                .append(this.getMessage()).append(this.getOrigExchange()).toHashCode();
    }

    /**
     * @return String representation of object
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this).append("msgId", this.getMsgId()).append("msgType", this.getMsgType())
                .append("message", this.getMessage()).append("origExchange", this.getOrigExchange()).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 UpdateNewsBulletin that = (UpdateNewsBulletin) thatObject;

        return equal(this.getMsgId(), that.getMsgId()) && equal(this.getMsgType(), that.getMsgType())
                && equal(this.getMessage(), that.getMessage())
                && equal(this.getOrigExchange(), that.getOrigExchange());
    }

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

    // UpdateNewsBulletin value-object java merge-point
}