Class AttributeType

java.lang.Object
org.tinyradius.attribute.util.AttributeType

public class AttributeType
extends java.lang.Object
Represents a Radius attribute type.
  • Constructor Summary

    Constructors 
    Constructor Description
    AttributeType​(int vendorId, int type, java.lang.String name, java.lang.String rawDataType)
    Create a new attribute type.
  • Method Summary

    Modifier and Type Method Description
    void addEnumerationValue​(int num, java.lang.String name)
    Adds a name for an integer value of this attribute.
    RadiusAttribute create​(Dictionary dictionary, byte[] data)  
    RadiusAttribute create​(Dictionary dictionary, java.lang.String data)  
    java.lang.String getDataType()  
    java.lang.String getEnumeration​(int value)  
    java.lang.Integer getEnumeration​(java.lang.String value)  
    java.lang.String getName()  
    byte getType()  
    int getVendorId()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AttributeType

      public AttributeType​(int vendorId, int type, java.lang.String name, java.lang.String rawDataType)
      Create a new attribute type.
      Parameters:
      vendorId - vendor ID or -1 if N/A
      type - sub-attribute type code
      name - sub-attribute name
      rawDataType - string|octets|integer|date|ipaddr|ipv6addr|ipv6prefix
  • Method Details

    • create

      public RadiusAttribute create​(Dictionary dictionary, byte[] data)
    • create

      public RadiusAttribute create​(Dictionary dictionary, java.lang.String data)
    • getType

      public byte getType()
      Returns:
      Radius type code for this attribute e.g. '1' (for User-Name)
    • getName

      public java.lang.String getName()
      Returns:
      name of type e.g. 'User-Name'
    • getVendorId

      public int getVendorId()
      Returns:
      vendor ID or -1 if not applicable
    • getDataType

      public java.lang.String getDataType()
    • getEnumeration

      public java.lang.String getEnumeration​(int value)
      Parameters:
      value - int value
      Returns:
      the name of the given integer value if this attribute is an enumeration, or null if it is not or if the integer value is unknown.
    • getEnumeration

      public java.lang.Integer getEnumeration​(java.lang.String value)
      Parameters:
      value - string value
      Returns:
      the number of the given string value if this attribute is an enumeration, or null if it is not or if the string value is unknown.
    • addEnumerationValue

      public void addEnumerationValue​(int num, java.lang.String name)
      Adds a name for an integer value of this attribute.
      Parameters:
      num - number that shall get a name
      name - the name for this number
    • toString

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