Package org.tinyradius.attribute
Class RadiusAttribute
java.lang.Object
org.tinyradius.attribute.RadiusAttribute
- Direct Known Subclasses:
IntegerAttribute
,IpAttribute
,Ipv6PrefixAttribute
,StringAttribute
,VendorSpecificAttribute
public class RadiusAttribute
extends java.lang.Object
This class represents a generic Radius attribute. Subclasses implement
methods to access the fields of special attributes.
-
Constructor Summary
Constructors Constructor Description RadiusAttribute(Dictionary dictionary, int vendorId, byte type, byte[] value)
RadiusAttribute(Dictionary dictionary, int vendorId, byte type, java.lang.String value)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getAttributeKey()
java.util.Map<java.lang.String,java.lang.String>
getAttributeMap()
Returns set of entry of Attribute name and Value as string.AttributeType
getAttributeType()
Dictionary
getDictionary()
byte
getType()
byte[]
getValue()
java.lang.String
getValueString()
int
getVendorId()
int
hashCode()
byte[]
toByteArray()
java.lang.String
toString()
-
Constructor Details
-
RadiusAttribute
- Parameters:
dictionary
- dictionary to usevendorId
- vendor ID or -1type
- attribute type codevalue
- value of attribute as byte array
-
RadiusAttribute
- Parameters:
dictionary
- dictionary to usevendorId
- vendor ID or -1type
- attribute type codevalue
- value of attribute as hex string
-
-
Method Details
-
getValue
public byte[] getValue()- Returns:
- attribute data as raw bytes
-
getType
public byte getType()- Returns:
- attribute type code, 0-255
-
getValueString
public java.lang.String getValueString()- Returns:
- value of this attribute as a hex string.
-
getVendorId
public int getVendorId()- Returns:
- vendor Id if Vendor-Specific attribute or sub-attribute, otherwise -1
-
getDictionary
- Returns:
- dictionary that attribute uses
-
toByteArray
public byte[] toByteArray()- Returns:
- entire attribute (including headers) as byte array
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getAttributeKey
public java.lang.String getAttributeKey() -
getAttributeMap
public java.util.Map<java.lang.String,java.lang.String> getAttributeMap()Returns set of entry of Attribute name and Value as string. Size is generally 1, except in case of VendorSpecificAttribute where it is merge of sub-attributes.- Returns:
- Set of String/String Entry
-
getAttributeType
- Returns:
- AttributeType object for (sub-)attribute or null
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-