Package org.tinyradius.attribute.util
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()
-
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/Atype
- sub-attribute type codename
- sub-attribute namerawDataType
- string|octets|integer|date|ipaddr|ipv6addr|ipv6prefix
-
-
Method Details
-
create
-
create
-
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 namename
- the name for this number
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-