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::TickEFP * 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 TickEFP */ public class TickEFP implements Serializable, Comparable<TickEFP> { /** The serial version UID of this class. Needed for serialization. */ private static final long serialVersionUID = -3984659740670733440L; // 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 field */ protected int field; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setField = false; /** TODO: Model Documentation for attribute basisPoints */ protected double basisPoints; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setBasisPoints = false; /** TODO: Model Documentation for attribute formattedBasisPoints */ protected String formattedBasisPoints; /** TODO: Model Documentation for attribute impliedFuture */ protected double impliedFuture; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setImpliedFuture = false; /** TODO: Model Documentation for attribute holdDays */ protected int holdDays; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setHoldDays = false; /** TODO: Model Documentation for attribute futureExpiry */ protected String futureExpiry; /** TODO: Model Documentation for attribute dividendImpact */ protected double dividendImpact; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setDividendImpact = false; /** TODO: Model Documentation for attribute dividendsToExpiry */ protected double dividendsToExpiry; /** * boolean setter for primitive attribute, so we can tell if it's initialized */ protected boolean setDividendsToExpiry = false; /** Default Constructor with no properties */ public TickEFP() { // Documented empty block - avoid compiler warning - no super constructor } /** * Constructor with all properties * @param tickerIdIn int * @param fieldIn int * @param basisPointsIn double * @param formattedBasisPointsIn String * @param impliedFutureIn double * @param holdDaysIn int * @param futureExpiryIn String * @param dividendImpactIn double * @param dividendsToExpiryIn double */ public TickEFP(final int tickerIdIn, final int fieldIn, final double basisPointsIn, final String formattedBasisPointsIn, final double impliedFutureIn, final int holdDaysIn, final String futureExpiryIn, final double dividendImpactIn, final double dividendsToExpiryIn) { this.tickerId = tickerIdIn; this.setTickerId = true; this.field = fieldIn; this.setField = true; this.basisPoints = basisPointsIn; this.setBasisPoints = true; this.formattedBasisPoints = formattedBasisPointsIn; this.impliedFuture = impliedFutureIn; this.setImpliedFuture = true; this.holdDays = holdDaysIn; this.setHoldDays = true; this.futureExpiry = futureExpiryIn; this.dividendImpact = dividendImpactIn; this.setDividendImpact = true; this.dividendsToExpiry = dividendsToExpiryIn; this.setDividendsToExpiry = true; } /** * Copies constructor from other TickEFP * * @param otherBean Cannot be <code>null</code> * @throws NullPointerException if the argument is <code>null</code> */ public TickEFP(final TickEFP otherBean) { this.tickerId = otherBean.getTickerId(); this.setTickerId = true; this.field = otherBean.getField(); this.setField = true; this.basisPoints = otherBean.getBasisPoints(); this.setBasisPoints = true; this.formattedBasisPoints = otherBean.getFormattedBasisPoints(); this.impliedFuture = otherBean.getImpliedFuture(); this.setImpliedFuture = true; this.holdDays = otherBean.getHoldDays(); this.setHoldDays = true; this.futureExpiry = otherBean.getFutureExpiry(); this.dividendImpact = otherBean.getDividendImpact(); this.setDividendImpact = true; this.dividendsToExpiry = otherBean.getDividendsToExpiry(); this.setDividendsToExpiry = true; } /** * Copies all properties from the argument value object into this value object. * @param otherBean Cannot be <code>null</code> */ public void copy(final TickEFP otherBean) { if (null != otherBean) { this.setTickerId(otherBean.getTickerId()); this.setTickerId = true; this.setField(otherBean.getField()); this.setField = true; this.setBasisPoints(otherBean.getBasisPoints()); this.setBasisPoints = true; this.setFormattedBasisPoints(otherBean.getFormattedBasisPoints()); this.setImpliedFuture(otherBean.getImpliedFuture()); this.setImpliedFuture = true; this.setHoldDays(otherBean.getHoldDays()); this.setHoldDays = true; this.setFutureExpiry(otherBean.getFutureExpiry()); this.setDividendImpact(otherBean.getDividendImpact()); this.setDividendImpact = true; this.setDividendsToExpiry(otherBean.getDividendsToExpiry()); this.setDividendsToExpiry = 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 field * Get the field Attribute * @return field int */ public int getField() { return this.field; } /** * * @param value int */ public void setField(final int value) { this.field = value; this.setField = true; } /** * Return true if the primitive attribute field is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetField() { return this.setField; } /** * TODO: Model Documentation for attribute basisPoints * Get the basisPoints Attribute * @return basisPoints double */ public double getBasisPoints() { return this.basisPoints; } /** * * @param value double */ public void setBasisPoints(final double value) { this.basisPoints = value; this.setBasisPoints = true; } /** * Return true if the primitive attribute basisPoints is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetBasisPoints() { return this.setBasisPoints; } /** * TODO: Model Documentation for attribute formattedBasisPoints * Get the formattedBasisPoints Attribute * @return formattedBasisPoints String */ public String getFormattedBasisPoints() { return this.formattedBasisPoints; } /** * * @param value String */ public void setFormattedBasisPoints(final String value) { this.formattedBasisPoints = value; } /** * TODO: Model Documentation for attribute impliedFuture * Get the impliedFuture Attribute * @return impliedFuture double */ public double getImpliedFuture() { return this.impliedFuture; } /** * * @param value double */ public void setImpliedFuture(final double value) { this.impliedFuture = value; this.setImpliedFuture = true; } /** * Return true if the primitive attribute impliedFuture is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetImpliedFuture() { return this.setImpliedFuture; } /** * TODO: Model Documentation for attribute holdDays * Get the holdDays Attribute * @return holdDays int */ public int getHoldDays() { return this.holdDays; } /** * * @param value int */ public void setHoldDays(final int value) { this.holdDays = value; this.setHoldDays = true; } /** * Return true if the primitive attribute holdDays is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetHoldDays() { return this.setHoldDays; } /** * TODO: Model Documentation for attribute futureExpiry * Get the futureExpiry Attribute * @return futureExpiry String */ public String getFutureExpiry() { return this.futureExpiry; } /** * * @param value String */ public void setFutureExpiry(final String value) { this.futureExpiry = value; } /** * TODO: Model Documentation for attribute dividendImpact * Get the dividendImpact Attribute * @return dividendImpact double */ public double getDividendImpact() { return this.dividendImpact; } /** * * @param value double */ public void setDividendImpact(final double value) { this.dividendImpact = value; this.setDividendImpact = true; } /** * Return true if the primitive attribute dividendImpact is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetDividendImpact() { return this.setDividendImpact; } /** * TODO: Model Documentation for attribute dividendsToExpiry * Get the dividendsToExpiry Attribute * @return dividendsToExpiry double */ public double getDividendsToExpiry() { return this.dividendsToExpiry; } /** * * @param value double */ public void setDividendsToExpiry(final double value) { this.dividendsToExpiry = value; this.setDividendsToExpiry = true; } /** * Return true if the primitive attribute dividendsToExpiry is set, through the setter or constructor * @return true if the attribute value has been set */ public boolean isSetDividendsToExpiry() { return this.setDividendsToExpiry; } /** * @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; } TickEFP rhs = (TickEFP) object; return new EqualsBuilder().append(this.getTickerId(), rhs.getTickerId()) .append(this.getField(), rhs.getField()).append(this.getBasisPoints(), rhs.getBasisPoints()) .append(this.getFormattedBasisPoints(), rhs.getFormattedBasisPoints()) .append(this.getImpliedFuture(), rhs.getImpliedFuture()) .append(this.getHoldDays(), rhs.getHoldDays()).append(this.getFutureExpiry(), rhs.getFutureExpiry()) .append(this.getDividendImpact(), rhs.getDividendImpact()) .append(this.getDividendsToExpiry(), rhs.getDividendsToExpiry()).isEquals(); } /** * @param object to compare this object against * @return int if equal * @see Comparable#compareTo(Object) */ public int compareTo(final TickEFP 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.getField(), object.getField()).append(this.getBasisPoints(), object.getBasisPoints()) .append(this.getFormattedBasisPoints(), object.getFormattedBasisPoints()) .append(this.getImpliedFuture(), object.getImpliedFuture()) .append(this.getHoldDays(), object.getHoldDays()) .append(this.getFutureExpiry(), object.getFutureExpiry()) .append(this.getDividendImpact(), object.getDividendImpact()) .append(this.getDividendsToExpiry(), object.getDividendsToExpiry()).toComparison(); } /** * @return int hashCode value * @see Object#hashCode() */ @Override public int hashCode() { return new HashCodeBuilder(1249046965, -82296885).append(this.getTickerId()).append(this.getField()) .append(this.getBasisPoints()).append(this.getFormattedBasisPoints()) .append(this.getImpliedFuture()).append(this.getHoldDays()).append(this.getFutureExpiry()) .append(this.getDividendImpact()).append(this.getDividendsToExpiry()).toHashCode(); } /** * @return String representation of object * @see Object#toString() */ @Override public String toString() { return new ToStringBuilder(this).append("tickerId", this.getTickerId()).append("field", this.getField()) .append("basisPoints", this.getBasisPoints()) .append("formattedBasisPoints", this.getFormattedBasisPoints()) .append("impliedFuture", this.getImpliedFuture()).append("holdDays", this.getHoldDays()) .append("futureExpiry", this.getFutureExpiry()).append("dividendImpact", this.getDividendImpact()) .append("dividendsToExpiry", this.getDividendsToExpiry()).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 TickEFP that = (TickEFP) thatObject; return equal(this.getTickerId(), that.getTickerId()) && equal(this.getField(), that.getField()) && equal(this.getBasisPoints(), that.getBasisPoints()) && equal(this.getFormattedBasisPoints(), that.getFormattedBasisPoints()) && equal(this.getImpliedFuture(), that.getImpliedFuture()) && equal(this.getHoldDays(), that.getHoldDays()) && equal(this.getFutureExpiry(), that.getFutureExpiry()) && equal(this.getDividendImpact(), that.getDividendImpact()) && equal(this.getDividendsToExpiry(), that.getDividendsToExpiry()); } /** * 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; } // TickEFP value-object java merge-point }