Class ServiceIDLookupImpl

  • All Implemented Interfaces:
    ServiceIDLookup, java.io.Serializable, java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.Long>>

    public final class ServiceIDLookupImpl
    extends java.lang.Object
    implements ServiceIDLookup, java.io.Serializable
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      long getIDForName​(java.lang.String name)
      Lookup the numerical identifier which is currently mapped to a particular service name in the DiameterCharging service's serviceID configuration.
      long[] getIds()  
      java.lang.String[] getNames()  
      java.lang.String getServiceNameForID​(long id)
      Lookup the name which is currently mapped to a particular service ID in the DiameterCharging service's service ID configuration.
      int hashCode()  
      java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.Long>> iterator()  
      void put​(long id, java.lang.String name)
      Used by the codec to decode an id/name entry.
      void setNewConfiguration​(long[] ids, java.lang.String[] names)
      Re-initialize the configuration with a new set of IDs and names.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • ServiceIDLookupImpl

        public ServiceIDLookupImpl()
    • Method Detail

      • getServiceNameForID

        public java.lang.String getServiceNameForID​(long id)
        Description copied from interface: ServiceIDLookup
        Lookup the name which is currently mapped to a particular service ID in the DiameterCharging service's service ID configuration.
        Specified by:
        getServiceNameForID in interface ServiceIDLookup
        Parameters:
        id - The service ID as it appears in the MSCC's 'serviceIDs' AVP
        Returns:
        The name currently mapped to the ID or null if there is currently no name mapped to the ID.
      • getIDForName

        public long getIDForName​(java.lang.String name)
        Description copied from interface: ServiceIDLookup
        Lookup the numerical identifier which is currently mapped to a particular service name in the DiameterCharging service's serviceID configuration.
        Specified by:
        getIDForName in interface ServiceIDLookup
        Parameters:
        name - The service name as it is used e.g. by the promotion features to identify a service
        Returns:
        The ID currently mapped to the name or -1 if there is currently no name mapped to the ID.
      • iterator

        public java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.Long>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.Long>>
      • setNewConfiguration

        public void setNewConfiguration​(long[] ids,
                                        java.lang.String[] names)
        Re-initialize the configuration with a new set of IDs and names.
        Parameters:
        ids - The list of numeric IDs. If null, 'names' has to be null as well.
        names - The list of human readable names. If null, 'ids' has to be null as well.
        Throws:
        java.lang.IllegalArgumentException - If the two lists are of unequal length or just one of them is null.
      • put

        public void put​(long id,
                        java.lang.String name)
        Used by the codec to decode an id/name entry. This approach is faster than having the codec build two lists and then iterating over those lists to populate the maps. Be aware that the inputs are not validated for efficiency reasons since this method is not intended for use other than by codecs.
        Parameters:
        id -
        name -
      • getNames

        public java.lang.String[] getNames()
        Returns:
        The list of names which was originally used to create this configuration via 'setNewConfiguration'.
      • getIds

        public long[] getIds()
        Returns:
        The list of IDs which was originally used to create this configuration via 'setNewConfiguration'.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object