Package org.onosproject.net.intent
Class Key
- java.lang.Object
-
- org.onosproject.net.intent.Key
-
- All Implemented Interfaces:
java.lang.Comparable<Key>
,ResourceConsumer
@Beta public abstract class Key extends java.lang.Object implements java.lang.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(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.
-
-
-
Method Detail
-
hash
public long hash()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
of
public static Key of(java.lang.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
-
-