org.tinyradius.attribute
Class IntegerAttribute

java.lang.Object
  extended by org.tinyradius.attribute.RadiusAttribute
      extended by org.tinyradius.attribute.IntegerAttribute

public class IntegerAttribute
extends RadiusAttribute

This class represents a Radius attribute which only contains a 32 bit integer.


Constructor Summary
IntegerAttribute()
          Constructs an empty integer attribute.
IntegerAttribute(int type, int value)
          Constructs an integer attribute with the given value.
 
Method Summary
 java.lang.String getAttributeValue()
          Returns the value of this attribute as a string.
 int getAttributeValueInt()
          Returns the string value of this attribute.
 void readAttribute(byte[] data, int offset, int length)
          Check attribute length.
 void setAttributeValue(int value)
          Sets the value of this attribute.
 void setAttributeValue(java.lang.String value)
          Sets the value of this attribute.
 
Methods inherited from class org.tinyradius.attribute.RadiusAttribute
createRadiusAttribute, createRadiusAttribute, createRadiusAttribute, getAttributeData, getAttributeType, getAttributeTypeObject, getDictionary, getVendorId, setAttributeData, setAttributeType, setDictionary, setVendorId, toString, writeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerAttribute

public IntegerAttribute()
Constructs an empty integer attribute.


IntegerAttribute

public IntegerAttribute(int type,
                        int value)
Constructs an integer attribute with the given value.

Parameters:
type - attribute type
value - attribute value
Method Detail

getAttributeValueInt

public int getAttributeValueInt()
Returns the string value of this attribute.

Returns:
a string

getAttributeValue

public java.lang.String getAttributeValue()
Returns the value of this attribute as a string. Tries to resolve enumerations.

Overrides:
getAttributeValue in class RadiusAttribute
Returns:
value
See Also:
RadiusAttribute.getAttributeValue()

setAttributeValue

public void setAttributeValue(int value)
Sets the value of this attribute.

Parameters:
value - integer value

setAttributeValue

public void setAttributeValue(java.lang.String value)
Sets the value of this attribute.

Overrides:
setAttributeValue in class RadiusAttribute
Parameters:
value - value as a string
Throws:
java.lang.NumberFormatException - if value is not a number and constant cannot be resolved
See Also:
RadiusAttribute.setAttributeValue(java.lang.String)

readAttribute

public void readAttribute(byte[] data,
                          int offset,
                          int length)
                   throws RadiusException
Check attribute length.

Overrides:
readAttribute in class RadiusAttribute
Throws:
RadiusException
See Also:
RadiusAttribute.readAttribute(byte[], int, int)