1 package org
.argeo
.api
.uuid
;
6 * An object identified by a {@link UUID}. Typically used to fasten indexing and
7 * comparisons of objects or records. THe method to implement is {@link #uuid()}
8 * so that any record with an <code>uuid</code> field can easily be enriched
11 public interface UuidIdentified
{
12 /** The UUID identifier. */
15 /** The UUID identifier, for compatibility with beans accessors. */
16 default UUID
getUuid() {
21 * Helper to implement the equals method of an {@link UuidIdentified}.<br/>
25 * public boolean equals(Object o) {
26 * return UuidIdentified.equals(this, o);
30 static boolean equals(UuidIdentified uuidIdentified
, Object o
) {
31 assert uuidIdentified
!= null;
34 if (uuidIdentified
== o
)
36 if (o
instanceof UuidIdentified u
)
37 return uuidIdentified
.uuid().equals(u
.uuid());
43 * Helper to implement the hash code method of an {@link UuidIdentified}.<br/>
47 * public int hashCode() {
48 * return UuidIdentified.hashCode(this);
52 static int hashCode(UuidIdentified uuidIdentified
) {
53 assert uuidIdentified
!= null;
54 return uuidIdentified
.getUuid().hashCode();