Package org.tinyradius.attribute
Class AttributeType
- java.lang.Object
-
- org.tinyradius.attribute.AttributeType
-
public class AttributeType extends java.lang.Object
Represents a Radius attribute type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AttributeType.ByteArrayConstructor<T extends RadiusAttribute>
static interface
AttributeType.StringConstructor<T extends RadiusAttribute>
-
Constructor Summary
Constructors Constructor Description AttributeType(int vendorId, int attributeType, java.lang.String name, java.lang.String rawDataType)
Constructs a Vendor-Specific sub-attribute type.AttributeType(int attributeType, java.lang.String name, java.lang.String typeStr)
Create a new attribute type.
-
Method Summary
All Methods Instance Methods Concrete Methods 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()
int
getTypeCode()
int
getVendorId()
java.lang.String
toString()
-
-
-
Constructor Detail
-
AttributeType
public AttributeType(int attributeType, java.lang.String name, java.lang.String typeStr)
Create a new attribute type.- Parameters:
attributeType
- Radius attribute type codename
- Attribute type nametypeStr
- string|octets|integer|date|ipaddr|ipv6addr|ipv6prefix
-
AttributeType
public AttributeType(int vendorId, int attributeType, java.lang.String name, java.lang.String rawDataType)
Constructs a Vendor-Specific sub-attribute type.- Parameters:
vendorId
- vendor IDattributeType
- sub-attribute type codename
- sub-attribute namerawDataType
- string|octets|integer|date|ipaddr|ipv6addr|ipv6prefix
-
-
Method Detail
-
create
public RadiusAttribute create(Dictionary dictionary, byte[] data)
-
create
public RadiusAttribute create(Dictionary dictionary, java.lang.String data)
-
getTypeCode
public int getTypeCode()
- 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
-
-