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

com.recombee.api_client.bindings.CartAddition Maven / Gradle / Ivy

There is a newer version: 4.1.5
Show newest version
package com.recombee.api_client.bindings;

/*
 This file is auto-generated, do not edit
*/

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.Map;
import java.util.Date;

public class CartAddition extends RecombeeBinding {
    /**
     * User who added the item to the cart
     */
    protected String userId;
    /**
     * Item added to the cart
     */
    protected String itemId;
    /**
     * UTC timestamp of the cart addition as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
     */
    protected Date timestamp;

    public CartAddition () {}

    public CartAddition (String userId,String itemId,Date timestamp) {
        this.userId = userId;
        this.itemId = itemId;
        this.timestamp = timestamp;
    }

    public CartAddition (Map jsonObject) {
        this.userId = (String) jsonObject.get("userId");
        this.itemId = (String) jsonObject.get("itemId");
        Double epoch = 1000*(Double)jsonObject.get("timestamp");
        this.timestamp = new Date(epoch.longValue());
    }

    public void setTimestamp(double epoch)
    {
         this.timestamp = new Date( (long) (1000 * epoch));
    }

    public String getUserId() {
         return this.userId;
    }

    public String getItemId() {
         return this.itemId;
    }

    public Date getTimestamp() {
         return this.timestamp;
    }

    @Override
    public int hashCode() {
    return new HashCodeBuilder(17, 31).
        append(this.userId).
        append(this.itemId).
        append(this.timestamp).
        toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
         if (!(obj instanceof CartAddition))
             return false;
         if (obj == this)
             return true;
    
         CartAddition rhs = (CartAddition) obj;
         return new EqualsBuilder().
            append(this.userId, rhs.userId).
            append(this.itemId, rhs.itemId).
            append(this.timestamp, rhs.timestamp).
            isEquals();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy