@Beta public abstract class Key extends java.lang.Object implements java.lang.Comparable<Key>, ResourceConsumer
Modifier | Constructor and Description |
---|---|
protected |
Key(long hash) |
Modifier and Type | Method and Description |
---|---|
ResourceConsumerId |
consumerId()
Returns ID of this consumer.
|
abstract boolean |
equals(java.lang.Object obj) |
long |
hash() |
int |
hashCode() |
static Key |
of(long key,
ApplicationId appId)
Creates a key based on the provided long.
|
static Key |
of(java.lang.String key,
ApplicationId appId)
Creates a key based on the provided string.
|
public long hash()
public int hashCode()
hashCode
in class java.lang.Object
public abstract boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static Key of(java.lang.String key, ApplicationId appId)
Note: Two keys with equal value, but different appId, are not equal.
Warning: it is caller responsibility to make sure the hashed value of
value
is unique.
key
- the provided stringappId
- application id to associate with this keypublic static Key of(long key, ApplicationId appId)
Note: Two keys with equal value, but different appId, are not equal. Also, "10" and 10L are different.
key
- the provided longappId
- application id to associate with this keypublic ResourceConsumerId consumerId()
ResourceConsumer
consumerId
in interface ResourceConsumer