Class MemoryDictionary

java.lang.Object
org.tinyradius.core.dictionary.MemoryDictionary
All Implemented Interfaces:
CoreDictionary, Dictionary, WritableDictionary

public class MemoryDictionary
extends java.lang.Object
implements WritableDictionary
A dictionary that keeps the values and names in hash maps in the memory. The dictionary has to be filled using the methods addAttributeTemplate and addVendor.
  • Constructor Details

  • Method Details

    • getAttributeTemplate

      public java.util.Optional<AttributeTemplate> getAttributeTemplate​(int vendorCode, byte attributeId)
      Description copied from interface: CoreDictionary
      Retrieves an AttributeTemplate for a vendor-specific attribute.
      Specified by:
      getAttributeTemplate in interface CoreDictionary
      Parameters:
      vendorCode - vendorId if appropriate or -1
      attributeId - attributeId 1-255
      Returns:
      AttributeTemplate
    • getAttributeTemplate

      public java.util.Optional<AttributeTemplate> getAttributeTemplate​(java.lang.String name)
      Description copied from interface: CoreDictionary
      Retrieves an AttributeTemplate by name. This includes vendor-specific attribute types whose name is prefixed by the vendor name.
      Specified by:
      getAttributeTemplate in interface CoreDictionary
      Parameters:
      name - attribute name
      Returns:
      AttributeTemplate object or null
    • getVendorId

      public int getVendorId​(java.lang.String vendorName)
      Description copied from interface: CoreDictionary
      Retrieves the ID of the vendor with the given name.
      Specified by:
      getVendorId in interface CoreDictionary
      Parameters:
      vendorName - name of the vendor
      Returns:
      vendorId or -1
    • getVendorName

      public java.util.Optional<java.lang.String> getVendorName​(int vendorId)
      Description copied from interface: CoreDictionary
      Retrieves the name of the vendor with the given vendor code.
      Specified by:
      getVendorName in interface CoreDictionary
      Parameters:
      vendorId - vendor number
      Returns:
      vendor name or null
    • addVendor

      public void addVendor​(int vendorId, java.lang.String vendorName)
      Description copied from interface: WritableDictionary
      Adds the given vendor to the dictionary.
      Specified by:
      addVendor in interface WritableDictionary
      Parameters:
      vendorId - vendor ID
      vendorName - name of the vendor
    • addAttributeTemplate

      public void addAttributeTemplate​(AttributeTemplate attributeTemplate)
      Adds an AttributeTemplate object to the cache.
      Specified by:
      addAttributeTemplate in interface WritableDictionary
      Parameters:
      attributeTemplate - AttributeTemplate object
      Throws:
      java.lang.IllegalArgumentException - duplicate attribute name/type code