Package org.onosproject.net.intent
Class Key
- java.lang.Object
-
- org.onosproject.net.intent.Key
-
- All Implemented Interfaces:
Comparable<Key>
,ResourceConsumer
@Beta public abstract class Key extends Object implements Comparable<Key>, ResourceConsumer
Key class for Intents.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Key(long hash)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ResourceConsumerId
consumerId()
Returns ID of this consumer.abstract boolean
equals(Object obj)
long
hash()
int
hashCode()
static Key
of(long key, ApplicationId appId)
Creates a key based on the provided long.static Key
of(String key, ApplicationId appId)
Creates a key based on the provided string.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
hash
public long hash()
-
of
public static Key of(String key, ApplicationId appId)
Creates a key based on the provided string.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.- Parameters:
key
- the provided stringappId
- application id to associate with this key- Returns:
- the key for the string
-
of
public static Key of(long key, ApplicationId appId)
Creates a key based on the provided long.Note: Two keys with equal value, but different appId, are not equal. Also, "10" and 10L are different.
- Parameters:
key
- the provided longappId
- application id to associate with this key- Returns:
- the key for the long
-
consumerId
public ResourceConsumerId consumerId()
Description copied from interface:ResourceConsumer
Returns ID of this consumer.- Specified by:
consumerId
in interfaceResourceConsumer
- Returns:
- ID of this consumer
-
-