2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
6 package org.mxchange.jshopcore.model.product;
8 import java.text.MessageFormat;
9 import java.util.Objects;
10 import org.mxchange.jshopcore.BaseShopCore;
14 * @author Roland Haeder
16 public class BaseProduct extends BaseShopCore implements Product {
18 * Availability of product
20 private Boolean available;
25 private Long categoryId;
28 * Id number of product item
43 public int compareTo (final Product product) {
45 this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
47 // category should not be null
48 if (null == product) {
49 throw new NullPointerException("product is null"); //NOI18N
53 this.getLogger().debug(MessageFormat.format("this.id={0},product.id={1}", this.getItemId(), product.getItemId())); //NOI18N
55 // Is the id the same?
56 if (Objects.equals(this.getItemId(), product.getItemId())) {
57 // Same id, means same category
59 } else if (this.getItemId() > product.getItemId()) {
60 // This id is larger than compared to
64 // The other id is larger
69 public final Boolean getAvailable () {
70 return this.available;
74 public final void setAvailable (final Boolean available) {
75 this.available = available;
79 public final Long getCategoryId () {
80 return this.categoryId;
84 public final void setCategoryId (final Long categoryId) {
85 this.categoryId = categoryId;
89 public final Long getItemId () {
94 public final void setItemId (final Long itemId) {
99 public final Float getPrice () {
104 public final void setPrice (final Float price) {
109 public final String getTitle () {
114 public final void setTitle (final String title) {