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::HistoricalData * 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 HistoricalData */ public class HistoricalData implements Serializable, Comparable<HistoricalData> { /** The serial version UID of this class. Needed for serialization. */ private static final long serialVersionUID = -8983316542022701000L; // 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 date */ protected String date; /** TODO: Model Documentation for attribute open */ protected double open; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setOpen = false; /** TODO: Model Documentation for attribute high */ protected double high; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setHigh = false; /** TODO: Model Documentation for attribute low */ protected double low; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setLow = false; /** TODO: Model Documentation for attribute close */ protected double close; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setClose = false; /** TODO: Model Documentation for attribute volume */ protected int volume; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setVolume = false; /** TODO: Model Documentation for attribute count */ protected int count; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setCount = false; /** TODO: Model Documentation for attribute WAP */ protected double WAP; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setWAP = false; /** TODO: Model Documentation for attribute hasGaps */ protected boolean hasGaps; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setHasGaps = false; /** Default Constructor with no properties */ public HistoricalData() { // Documented empty block - avoid compiler warning - no super constructor } /** * Constructor with all properties * @param reqIdIn int * @param dateIn String * @param openIn double * @param highIn double * @param lowIn double * @param closeIn double * @param volumeIn int * @param countIn int * @param WAPIn double * @param hasGapsIn boolean */ public HistoricalData(final int reqIdIn, final String dateIn, final double openIn, final double highIn, final double lowIn, final double closeIn, final int volumeIn, final int countIn, final double WAPIn, final boolean hasGapsIn) { this.reqId = reqIdIn; this.setReqId = true; this.date = dateIn; this.open = openIn; this.setOpen = true; this.high = highIn; this.setHigh = true; this.low = lowIn; this.setLow = true; this.close = closeIn; this.setClose = true; this.volume = volumeIn; this.setVolume = true; this.count = countIn; this.setCount = true; this.WAP = WAPIn; this.setWAP = true; this.hasGaps = hasGapsIn; this.setHasGaps = true; } /** * Copies constructor from other HistoricalData * * @param otherBean Cannot be <code>null</code> * @throws NullPointerException if the argument is <code>null</code> */ public HistoricalData(final HistoricalData otherBean) { this.reqId = otherBean.getReqId(); this.setReqId = true; this.date = otherBean.getDate(); this.open = otherBean.getOpen(); this.setOpen = true; this.high = otherBean.getHigh(); this.setHigh = true; this.low = otherBean.getLow(); this.setLow = true; this.close = otherBean.getClose(); this.setClose = true; this.volume = otherBean.getVolume(); this.setVolume = true; this.count = otherBean.getCount(); this.setCount = true; this.WAP = otherBean.getWAP(); this.setWAP = true; this.hasGaps = otherBean.isHasGaps(); this.setHasGaps = true; } /** * Copies all properties from the argument value object into this value object. * @param otherBean Cannot be <code>null</code> */ public void copy(final HistoricalData otherBean) { if (null != otherBean) { this.setReqId(otherBean.getReqId()); this.setReqId = true; this.setDate(otherBean.getDate()); this.setOpen(otherBean.getOpen()); this.setOpen = true; this.setHigh(otherBean.getHigh()); this.setHigh = true; this.setLow(otherBean.getLow()); this.setLow = true; this.setClose(otherBean.getClose()); this.setClose = true; this.setVolume(otherBean.getVolume()); this.setVolume = true; this.setCount(otherBean.getCount()); this.setCount = true; this.setWAP(otherBean.getWAP()); this.setWAP = true; this.setHasGaps(otherBean.isHasGaps()); this.setHasGaps = true; } } /** * 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 date * Get the date Attribute * @return date String */ public String getDate() { return this.date; } /** * * @param value String */ public void setDate(final String value) { this.date = value; } /** * TODO: Model Documentation for attribute open * Get the open Attribute * @return open double */ public double getOpen() { return this.open; } /** * * @param value double */ public void setOpen(final double value) { this.open = value; this.setOpen = true; } /** * Return true if the primitive attribute open is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetOpen() { return this.setOpen; } /** * TODO: Model Documentation for attribute high * Get the high Attribute * @return high double */ public double getHigh() { return this.high; } /** * * @param value double */ public void setHigh(final double value) { this.high = value; this.setHigh = true; } /** * Return true if the primitive attribute high is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetHigh() { return this.setHigh; } /** * TODO: Model Documentation for attribute low * Get the low Attribute * @return low double */ public double getLow() { return this.low; } /** * * @param value double */ public void setLow(final double value) { this.low = value; this.setLow = true; } /** * Return true if the primitive attribute low is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetLow() { return this.setLow; } /** * TODO: Model Documentation for attribute close * Get the close Attribute * @return close double */ public double getClose() { return this.close; } /** * * @param value double */ public void setClose(final double value) { this.close = value; this.setClose = true; } /** * Return true if the primitive attribute close is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetClose() { return this.setClose; } /** * TODO: Model Documentation for attribute volume * Get the volume Attribute * @return volume int */ public int getVolume() { return this.volume; } /** * * @param value int */ public void setVolume(final int value) { this.volume = value; this.setVolume = true; } /** * Return true if the primitive attribute volume is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetVolume() { return this.setVolume; } /** * TODO: Model Documentation for attribute count * Get the count Attribute * @return count int */ public int getCount() { return this.count; } /** * * @param value int */ public void setCount(final int value) { this.count = value; this.setCount = true; } /** * Return true if the primitive attribute count is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetCount() { return this.setCount; } /** * TODO: Model Documentation for attribute WAP * Get the WAP Attribute * @return WAP double */ public double getWAP() { return this.WAP; } /** * * @param value double */ public void setWAP(final double value) { this.WAP = value; this.setWAP = true; } /** * Return true if the primitive attribute WAP is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetWAP() { return this.setWAP; } /** * TODO: Model Documentation for attribute hasGaps * Get the hasGaps Attribute * @return hasGaps boolean */ public boolean isHasGaps() { return this.hasGaps; } /** * * Duplicates isBoolean method, for use as Jaxb2 compatible object * Get the hasGaps Attribute * @return hasGaps boolean */ @Deprecated public boolean getHasGaps() { return this.hasGaps; } /** * * @param value boolean */ public void setHasGaps(final boolean value) { this.hasGaps = value; this.setHasGaps = true; } /** * Return true if the primitive attribute hasGaps is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetHasGaps() { return this.setHasGaps; } /** * @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; } HistoricalData rhs = (HistoricalData) object; return new EqualsBuilder().append(this.getReqId(), rhs.getReqId()).append(this.getDate(), rhs.getDate()) .append(this.getOpen(), rhs.getOpen()).append(this.getHigh(), rhs.getHigh()) .append(this.getLow(), rhs.getLow()).append(this.getClose(), rhs.getClose()) .append(this.getVolume(), rhs.getVolume()).append(this.getCount(), rhs.getCount()) .append(this.getWAP(), rhs.getWAP()).append(this.isHasGaps(), rhs.isHasGaps()).isEquals(); } /** * @param object to compare this object against * @return int if equal * @see Comparable#compareTo(Object) */ public int compareTo(final HistoricalData 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.getDate(), object.getDate()).append(this.getOpen(), object.getOpen()) .append(this.getHigh(), object.getHigh()).append(this.getLow(), object.getLow()) .append(this.getClose(), object.getClose()).append(this.getVolume(), object.getVolume()) .append(this.getCount(), object.getCount()).append(this.getWAP(), object.getWAP()) .append(this.isHasGaps(), object.isHasGaps()).toComparison(); } /** * @return int hashCode value * @see Object#hashCode() */ @Override public int hashCode() { return new HashCodeBuilder(1249046965, -82296885).append(this.getReqId()).append(this.getDate()) .append(this.getOpen()).append(this.getHigh()).append(this.getLow()).append(this.getClose()) .append(this.getVolume()).append(this.getCount()).append(this.getWAP()).append(this.isHasGaps()) .toHashCode(); } /** * @return String representation of object * @see Object#toString() */ @Override public String toString() { return new ToStringBuilder(this).append("reqId", this.getReqId()).append("date", this.getDate()) .append("open", this.getOpen()).append("high", this.getHigh()).append("low", this.getLow()) .append("close", this.getClose()).append("volume", this.getVolume()) .append("count", this.getCount()).append("WAP", this.getWAP()).append("hasGaps", this.isHasGaps()) .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 HistoricalData that = (HistoricalData) thatObject; return equal(this.getReqId(), that.getReqId()) && equal(this.getDate(), that.getDate()) && equal(this.getOpen(), that.getOpen()) && equal(this.getHigh(), that.getHigh()) && equal(this.getLow(), that.getLow()) && equal(this.getClose(), that.getClose()) && equal(this.getVolume(), that.getVolume()) && equal(this.getCount(), that.getCount()) && equal(this.getWAP(), that.getWAP()) && equal(this.isHasGaps(), that.isHasGaps()); } /** * 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; } // HistoricalData value-object java merge-point }