org.tinyradius.dictionary
Class AttributeType

java.lang.Object
  extended by org.tinyradius.dictionary.AttributeType

public class AttributeType
extends java.lang.Object

Represents a Radius attribute type.


Constructor Summary
AttributeType(int vendor, int code, java.lang.String name, java.lang.Class type)
          Constructs a Vendor-Specific sub-attribute type.
AttributeType(int code, java.lang.String name, java.lang.Class type)
          Create a new attribute type.
 
Method Summary
 void addEnumerationValue(int num, java.lang.String name)
          Adds a name for an integer value of this attribute.
 java.lang.Class getAttributeClass()
          Retrieves the RadiusAttribute descendant class which represents attributes of this type.
 java.lang.String getEnumeration(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.
 java.lang.Integer getEnumeration(java.lang.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.
 java.lang.String getName()
          Retrieves the name of this type.
 int getTypeCode()
          Retrieves the Radius type code for this attribute type.
 int getVendorId()
          Returns the vendor ID.
 void setAttributeClass(java.lang.Class type)
          Sets the RadiusAttribute descendant class which represents attributes of this type.
 void setName(java.lang.String name)
          Sets the name of this type.
 void setTypeCode(int code)
          Sets the Radius type code for this attribute type.
 void setVendorId(int vendorId)
          Sets the vendor ID.
 java.lang.String toString()
          String representation of AttributeType object for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeType

public AttributeType(int code,
                     java.lang.String name,
                     java.lang.Class type)
Create a new attribute type.

Parameters:
code - Radius attribute type code
name - Attribute type name
type - RadiusAttribute descendant who handles attributes of this type

AttributeType

public AttributeType(int vendor,
                     int code,
                     java.lang.String name,
                     java.lang.Class type)
Constructs a Vendor-Specific sub-attribute type.

Parameters:
vendor - vendor ID
code - sub-attribute type code
name - sub-attribute name
type - sub-attribute class
Method Detail

getTypeCode

public int getTypeCode()
Retrieves the Radius type code for this attribute type.

Returns:
Radius type code

setTypeCode

public void setTypeCode(int code)
Sets the Radius type code for this attribute type.

Parameters:
code - type code, 1-255

getName

public java.lang.String getName()
Retrieves the name of this type.

Returns:
name

setName

public void setName(java.lang.String name)
Sets the name of this type.

Parameters:
name - type name

getAttributeClass

public java.lang.Class getAttributeClass()
Retrieves the RadiusAttribute descendant class which represents attributes of this type.

Returns:
class

setAttributeClass

public void setAttributeClass(java.lang.Class type)
Sets the RadiusAttribute descendant class which represents attributes of this type.


getVendorId

public int getVendorId()
Returns the vendor ID. No vendor specific attribute = -1

Returns:
vendor ID

setVendorId

public void setVendorId(int vendorId)
Sets the vendor ID.

Parameters:
vendorId - vendor ID

getEnumeration

public java.lang.String getEnumeration(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.

Returns:
name

getEnumeration

public java.lang.Integer getEnumeration(java.lang.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.

Parameters:
value - string value
Returns:
Integer or null

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()
String representation of AttributeType object for debugging purposes.

Overrides:
toString in class java.lang.Object
Returns:
string
See Also:
Object.toString()