All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.pvanassen.steam.store.marketpage.OutstandingItem Maven / Gradle / Ivy

Go to download

A Java API to access the Steam community market through the HTTP interface. This may be against the TOS so be careful using it!

There is a newer version: 3.0.8
Show newest version
package nl.pvanassen.steam.store.marketpage;

import nl.pvanassen.steam.store.common.Item;

import java.util.Date;

/**
 * Item listed in the market
 * 
 * @author Paul van Assen
 */
public class OutstandingItem extends Item {

    private final String listingId;
    private final String assetId;
    private final int contextId;
    private final int price;
    private final Date listedSince;

    OutstandingItem(int appId, String urlName, String listingId, String assetId, int contextId, int price, Date listedSince) {
        super(appId, urlName);
        this.listingId = listingId;
        this.assetId = assetId;
        this.contextId = contextId;
        this.price = price;
        this.listedSince = listedSince;
    }

    /**
     * @return Context id
     */
    public int getContextId() {
        return contextId;
    }

    /**
     * @return The asset id
     */
    public String getAssetId() {
        return assetId;
    }

    /**
     * @return Listed since date
     */
    public Date getListedSince() {
        return new Date(listedSince.getTime());
    }

    /**
     * @return The listing ID
     */
    public String getListingId() {
        return listingId;
    }

    /**
     * @return Total price in cents
     */
    public int getPrice() {
        return price;
    }

    /**
     * {@inheritDoc}
     *
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + contextId;
        result = prime * result + ((assetId == null) ? 0 : assetId.hashCode());
        result = prime * result + ((listedSince == null) ? 0 : listedSince.hashCode());
        result = prime * result + ((listingId == null) ? 0 : listingId.hashCode());
        result = prime * result + price;
        return result;
    }

    /**
     * {@inheritDoc}
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!super.equals(obj)) {
            return false;
        }
        if (!(obj instanceof OutstandingItem)) {
            return false;
        }
        OutstandingItem other = (OutstandingItem) obj;
        if (contextId != other.contextId) {
            return false;
        }
        if (assetId == null) {
            if (other.assetId != null) {
                return false;
            }
        }
        else if (!assetId.equals(other.assetId)) {
            return false;
        }
        if (listedSince == null) {
            if (other.listedSince != null) {
                return false;
            }
        }
        else if (!listedSince.equals(other.listedSince)) {
            return false;
        }
        if (listingId == null) {
            if (other.listingId != null) {
                return false;
            }
        }
        else if (!listingId.equals(other.listingId)) {
            return false;
        }
        return price == other.price;
    }

    /**
     * {@inheritDoc}
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "OutstandingItem [listingId=" + listingId + ", itemId=" + assetId + ", contextId=" + contextId + ", price=" + price + ", listedSince=" + listedSince + "]";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy