Stocks.java

//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.7 
// See https://eclipse-ee4j.github.io/jaxb-ri 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2024.11.29 at 06:55:45 AM UTC 
//


package com.googlecode.phisix.api.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jvnet.jaxb2_commons.lang.Equals2;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy2;
import org.jvnet.jaxb2_commons.lang.HashCode2;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy2;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
 *       &lt;sequence&gt;
 *         &lt;element name="stock" type="{http://phisix-api.appspot.com/phisix-stocks}Stock" maxOccurs="unbounded"/&gt;
 *       &lt;/sequence&gt;
 *       &lt;attribute name="as_of" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" /&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "stocks"
})
@XmlRootElement(name = "stocks")
public class Stocks implements Serializable, Equals2, HashCode2, ToString2
{

    private final static long serialVersionUID = 100L;
    @XmlElement(name = "stock", required = true)
    protected List<Stock> stocks;
    @XmlAttribute(name = "as_of", required = true)
    @XmlJavaTypeAdapter(Adapter1 .class)
    @XmlSchemaType(name = "dateTime")
    protected Calendar asOf;

    /**
     * Gets the value of the stocks property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the stocks property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getStocks().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Stock }
     * 
     * 
     */
    public List<Stock> getStocks() {
        if (stocks == null) {
            stocks = new ArrayList<Stock>();
        }
        return this.stocks;
    }

    /**
     * Gets the value of the asOf property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public Calendar getAsOf() {
        return asOf;
    }

    /**
     * Sets the value of the asOf property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setAsOf(Calendar value) {
        this.asOf = value;
    }

    public void setStocks(List<Stock> value) {
        this.stocks = null;
        if (value!= null) {
            List<Stock> draftl = this.getStocks();
            draftl.addAll(value);
        }
    }

    public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) {
        if ((object == null)||(this.getClass()!= object.getClass())) {
            return false;
        }
        if (this == object) {
            return true;
        }
        final Stocks that = ((Stocks) object);
        {
            List<Stock> lhsStocks;
            lhsStocks = (((this.stocks!= null)&&(!this.stocks.isEmpty()))?this.getStocks():null);
            List<Stock> rhsStocks;
            rhsStocks = (((that.stocks!= null)&&(!that.stocks.isEmpty()))?that.getStocks():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "stocks", lhsStocks), LocatorUtils.property(thatLocator, "stocks", rhsStocks), lhsStocks, rhsStocks, ((this.stocks!= null)&&(!this.stocks.isEmpty())), ((that.stocks!= null)&&(!that.stocks.isEmpty())))) {
                return false;
            }
        }
        {
            Calendar lhsAsOf;
            lhsAsOf = this.getAsOf();
            Calendar rhsAsOf;
            rhsAsOf = that.getAsOf();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "asOf", lhsAsOf), LocatorUtils.property(thatLocator, "asOf", rhsAsOf), lhsAsOf, rhsAsOf, (this.asOf!= null), (that.asOf!= null))) {
                return false;
            }
        }
        return true;
    }

    public boolean equals(Object object) {
        final EqualsStrategy2 strategy = JAXBEqualsStrategy.INSTANCE;
        return equals(null, null, object, strategy);
    }

    public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) {
        int currentHashCode = 1;
        {
            List<Stock> theStocks;
            theStocks = (((this.stocks!= null)&&(!this.stocks.isEmpty()))?this.getStocks():null);
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "stocks", theStocks), currentHashCode, theStocks, ((this.stocks!= null)&&(!this.stocks.isEmpty())));
        }
        {
            Calendar theAsOf;
            theAsOf = this.getAsOf();
            currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "asOf", theAsOf), currentHashCode, theAsOf, (this.asOf!= null));
        }
        return currentHashCode;
    }

    public int hashCode() {
        final HashCodeStrategy2 strategy = JAXBHashCodeStrategy.INSTANCE;
        return this.hashCode(null, strategy);
    }

    public String toString() {
        final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE;
        final StringBuilder buffer = new StringBuilder();
        append(null, buffer, strategy);
        return buffer.toString();
    }

    public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
        strategy.appendStart(locator, this, buffer);
        appendFields(locator, buffer, strategy);
        strategy.appendEnd(locator, this, buffer);
        return buffer;
    }

    public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
        {
            List<Stock> theStocks;
            theStocks = (((this.stocks!= null)&&(!this.stocks.isEmpty()))?this.getStocks():null);
            strategy.appendField(locator, this, "stocks", buffer, theStocks, ((this.stocks!= null)&&(!this.stocks.isEmpty())));
        }
        {
            Calendar theAsOf;
            theAsOf = this.getAsOf();
            strategy.appendField(locator, this, "asOf", buffer, theAsOf, (this.asOf!= null));
        }
        return buffer;
    }

}