Java tutorial
// 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::UpdateMktDepth * 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 UpdateMktDepth */ public class UpdateMktDepth implements Serializable, Comparable<UpdateMktDepth> { /** The serial version UID of this class. Needed for serialization. */ private static final long serialVersionUID = 7621352239533962334L; // Class attributes /** TODO: Model Documentation for attribute tickerId */ protected int tickerId; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setTickerId = false; /** TODO: Model Documentation for attribute position */ protected int position; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setPosition = false; /** TODO: Model Documentation for attribute operation */ protected int operation; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setOperation = false; /** TODO: Model Documentation for attribute side */ protected int side; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setSide = false; /** TODO: Model Documentation for attribute price */ protected double price; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setPrice = false; /** TODO: Model Documentation for attribute size */ protected int size; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setSize = false; /** Default Constructor with no properties */ public UpdateMktDepth() { // Documented empty block - avoid compiler warning - no super constructor } /** * Constructor with all properties * @param tickerIdIn int * @param positionIn int * @param operationIn int * @param sideIn int * @param priceIn double * @param sizeIn int */ public UpdateMktDepth(final int tickerIdIn, final int positionIn, final int operationIn, final int sideIn, final double priceIn, final int sizeIn) { this.tickerId = tickerIdIn; this.setTickerId = true; this.position = positionIn; this.setPosition = true; this.operation = operationIn; this.setOperation = true; this.side = sideIn; this.setSide = true; this.price = priceIn; this.setPrice = true; this.size = sizeIn; this.setSize = true; } /** * Copies constructor from other UpdateMktDepth * * @param otherBean Cannot be <code>null</code> * @throws NullPointerException if the argument is <code>null</code> */ public UpdateMktDepth(final UpdateMktDepth otherBean) { this.tickerId = otherBean.getTickerId(); this.setTickerId = true; this.position = otherBean.getPosition(); this.setPosition = true; this.operation = otherBean.getOperation(); this.setOperation = true; this.side = otherBean.getSide(); this.setSide = true; this.price = otherBean.getPrice(); this.setPrice = true; this.size = otherBean.getSize(); this.setSize = true; } /** * Copies all properties from the argument value object into this value object. * @param otherBean Cannot be <code>null</code> */ public void copy(final UpdateMktDepth otherBean) { if (null != otherBean) { this.setTickerId(otherBean.getTickerId()); this.setTickerId = true; this.setPosition(otherBean.getPosition()); this.setPosition = true; this.setOperation(otherBean.getOperation()); this.setOperation = true; this.setSide(otherBean.getSide()); this.setSide = true; this.setPrice(otherBean.getPrice()); this.setPrice = true; this.setSize(otherBean.getSize()); this.setSize = true; } } /** * TODO: Model Documentation for attribute tickerId * Get the tickerId Attribute * @return tickerId int */ public int getTickerId() { return this.tickerId; } /** * * @param value int */ public void setTickerId(final int value) { this.tickerId = value; this.setTickerId = true; } /** * Return true if the primitive attribute tickerId is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetTickerId() { return this.setTickerId; } /** * TODO: Model Documentation for attribute position * Get the position Attribute * @return position int */ public int getPosition() { return this.position; } /** * * @param value int */ public void setPosition(final int value) { this.position = value; this.setPosition = true; } /** * Return true if the primitive attribute position is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetPosition() { return this.setPosition; } /** * TODO: Model Documentation for attribute operation * Get the operation Attribute * @return operation int */ public int getOperation() { return this.operation; } /** * * @param value int */ public void setOperation(final int value) { this.operation = value; this.setOperation = true; } /** * Return true if the primitive attribute operation is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetOperation() { return this.setOperation; } /** * TODO: Model Documentation for attribute side * Get the side Attribute * @return side int */ public int getSide() { return this.side; } /** * * @param value int */ public void setSide(final int value) { this.side = value; this.setSide = true; } /** * Return true if the primitive attribute side is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetSide() { return this.setSide; } /** * TODO: Model Documentation for attribute price * Get the price Attribute * @return price double */ public double getPrice() { return this.price; } /** * * @param value double */ public void setPrice(final double value) { this.price = value; this.setPrice = true; } /** * Return true if the primitive attribute price is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetPrice() { return this.setPrice; } /** * TODO: Model Documentation for attribute size * Get the size Attribute * @return size int */ public int getSize() { return this.size; } /** * * @param value int */ public void setSize(final int value) { this.size = value; this.setSize = true; } /** * Return true if the primitive attribute size is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetSize() { return this.setSize; } /** * @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; } UpdateMktDepth rhs = (UpdateMktDepth) object; return new EqualsBuilder().append(this.getTickerId(), rhs.getTickerId()) .append(this.getPosition(), rhs.getPosition()).append(this.getOperation(), rhs.getOperation()) .append(this.getSide(), rhs.getSide()).append(this.getPrice(), rhs.getPrice()) .append(this.getSize(), rhs.getSize()).isEquals(); } /** * @param object to compare this object against * @return int if equal * @see Comparable#compareTo(Object) */ public int compareTo(final UpdateMktDepth object) { if (object == null) { return -1; } // Check if the same object instance if (object == this) { return 0; } return new CompareToBuilder().append(this.getTickerId(), object.getTickerId()) .append(this.getPosition(), object.getPosition()).append(this.getOperation(), object.getOperation()) .append(this.getSide(), object.getSide()).append(this.getPrice(), object.getPrice()) .append(this.getSize(), object.getSize()).toComparison(); } /** * @return int hashCode value * @see Object#hashCode() */ @Override public int hashCode() { return new HashCodeBuilder(1249046965, -82296885).append(this.getTickerId()).append(this.getPosition()) .append(this.getOperation()).append(this.getSide()).append(this.getPrice()).append(this.getSize()) .toHashCode(); } /** * @return String representation of object * @see Object#toString() */ @Override public String toString() { return new ToStringBuilder(this).append("tickerId", this.getTickerId()) .append("position", this.getPosition()).append("operation", this.getOperation()) .append("side", this.getSide()).append("price", this.getPrice()).append("size", this.getSize()) .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 UpdateMktDepth that = (UpdateMktDepth) thatObject; return equal(this.getTickerId(), that.getTickerId()) && equal(this.getPosition(), that.getPosition()) && equal(this.getOperation(), that.getOperation()) && equal(this.getSide(), that.getSide()) && equal(this.getPrice(), that.getPrice()) && equal(this.getSize(), that.getSize()); } /** * 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; } // UpdateMktDepth value-object java merge-point }