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

com.softicar.platform.common.core.item.ItemId Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.core.item;

/**
 * Represents the ID of an {@link IBasicItem}.
 * 

* It is intentional that this class provides no conversion to {@link Integer}, * to {@link Long} or any other {@link Number}. The rationale is that working * with IDs is an error prone task and should be avoided. Basing any business * logic on untyped IDs is not a good idea, use actual business objects instead. * Usually, the only valid reason to work with IDs is to display them to the * user. * * @author Oliver Richers */ public class ItemId implements Comparable { private final long id; /** * Constructs this ID from the given {@link Long} value. * * @param id * the long value representing this ID */ public ItemId(long id) { this.id = id; } @Override public int compareTo(ItemId other) { return Long.compare(id, other.id); } @Override public boolean equals(Object other) { if (other instanceof ItemId) { return id == ((ItemId) other).id; } else { return false; } } @Override public int hashCode() { return Long.hashCode(id); } @Override public String toString() { return "" + id; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy