Class RadiusAttribute

java.lang.Object
org.tinyradius.attribute.RadiusAttribute
Direct Known Subclasses:
IntegerAttribute, IpAttribute, Ipv6PrefixAttribute, StringAttribute, VendorSpecificAttribute

public class RadiusAttribute
extends java.lang.Object
This class represents a generic Radius attribute. Subclasses implement methods to access the fields of special attributes.
  • Constructor Details

    • RadiusAttribute

      public RadiusAttribute​(Dictionary dictionary, int vendorId, byte type, byte[] value)
      Parameters:
      dictionary - dictionary to use
      vendorId - vendor ID or -1
      type - attribute type code
      value - value of attribute as byte array
    • RadiusAttribute

      public RadiusAttribute​(Dictionary dictionary, int vendorId, byte type, java.lang.String value)
      Parameters:
      dictionary - dictionary to use
      vendorId - vendor ID or -1
      type - attribute type code
      value - value of attribute as hex string
  • Method Details

    • getValue

      public byte[] getValue()
      Returns:
      attribute data as raw bytes
    • getType

      public byte getType()
      Returns:
      attribute type code, 0-255
    • getValueString

      public java.lang.String getValueString()
      Returns:
      value of this attribute as a hex string.
    • getVendorId

      public int getVendorId()
      Returns:
      vendor Id if Vendor-Specific attribute or sub-attribute, otherwise -1
    • getDictionary

      public Dictionary getDictionary()
      Returns:
      dictionary that attribute uses
    • toByteArray

      public byte[] toByteArray()
      Returns:
      entire attribute (including headers) as byte array
    • toString

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

      public java.lang.String getAttributeKey()
    • getAttributeMap

      public java.util.Map<java.lang.String,​java.lang.String> getAttributeMap()
      Returns set of entry of Attribute name and Value as string. Size is generally 1, except in case of VendorSpecificAttribute where it is merge of sub-attributes.
      Returns:
      Set of String/String Entry
    • getAttributeType

      public AttributeType getAttributeType()
      Returns:
      AttributeType object for (sub-)attribute or null
    • 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