Class VendorSpecificAttribute



  • public class VendorSpecificAttribute
    extends RadiusAttribute
    This class represents a "Vendor-Specific" attribute.
    • Constructor Detail

      • VendorSpecificAttribute

        public VendorSpecificAttribute​(Dictionary dictionary,
                                       int vendorId)
        Constructs a new Vendor-Specific attribute to be sent.
        Parameters:
        dictionary - dictionary to use for (sub)attributes
        vendorId - vendor ID of the sub-attributes
    • Method Detail

      • addSubAttribute

        public void addSubAttribute​(RadiusAttribute attribute)
        Adds a sub-attribute to this attribute.
        Parameters:
        attribute - sub-attribute to add
      • addSubAttribute

        public void addSubAttribute​(java.lang.String name,
                                    java.lang.String value)
        Adds a sub-attribute with the specified name to this attribute.
        Parameters:
        name - name of the sub-attribute
        value - value of the sub-attribute
        Throws:
        java.lang.IllegalArgumentException - invalid sub-attribute name or value
      • removeSubAttribute

        public void removeSubAttribute​(RadiusAttribute attribute)
        Removes the specified sub-attribute from this attribute.
        Parameters:
        attribute - RadiusAttribute to remove
      • getSubAttributes

        public java.util.List<RadiusAttribute> getSubAttributes​()
        Returns the list of sub-attributes.
        Returns:
        List of RadiusAttribute objects
      • getSubAttributes

        public java.util.List<RadiusAttribute> getSubAttributes​(int attributeType)
        Returns all sub-attributes of this attribute which have the given type.
        Parameters:
        attributeType - type of sub-attributes to get
        Returns:
        list of RadiusAttribute objects, does not return null
      • getSubAttribute

        public RadiusAttribute getSubAttribute​(int type)
        Returns a sub-attribute of the given type which may only occur once in this attribute.
        Parameters:
        type - sub-attribute type
        Returns:
        RadiusAttribute object or null if there is no such sub-attribute
        Throws:
        java.lang.RuntimeException - if there are multiple occurrences of the requested sub-attribute type
      • getSubAttribute

        public RadiusAttribute getSubAttribute​(java.lang.String type)
        Returns a single sub-attribute of the given type name.
        Parameters:
        type - attribute type name
        Returns:
        RadiusAttribute object or null if there is no such attribute
        Throws:
        java.lang.RuntimeException - if the attribute occurs multiple times
      • toByteArray

        public byte[] toByteArray​()
        Renders this attribute as a byte array.
        Overrides:
        toByteArray in class RadiusAttribute
        Returns:
        entire attribute (including headers) as byte array
      • toString

        public java.lang.String toString​()
        Returns a string representation for debugging.
        Overrides:
        toString in class RadiusAttribute
      • toAttributeMap

        public java.util.Map<java.lang.String,java.lang.String> toAttributeMap​()
        Description copied from class: RadiusAttribute
        Returns set of entry of Attribute name and Value as string. Size is generally 1, except in case of VendorSpecificAttribute where it is aggregate of sub-attributes.
        Overrides:
        toAttributeMap in class RadiusAttribute
        Returns:
        Set of String/String Entry