|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object issrg.ac.Attribute
public class Attribute
This class represents an Attribute ASN.1 construct. It contains a vector of values, each of them being a subclass of AttributeValue.
This class maintains a register of AttributeValue subclasses, one per attribute object identifier (OID). This way it can construct the specific AttributeValue subclasses when an Attribute with a specific OID is encountered By default, it creates just AttributeValue elements when parsing an ASN1Object, but you can register your own AttributeValue subclasses using registerAttribute method. The subclasses must have a constructor with ASN1Object as a parameter.
registerAttribute(java.lang.String, java.lang.Class)
Field Summary | |
---|---|
protected static java.util.Map |
registry
|
protected java.lang.String |
type
|
protected java.util.Vector |
values
|
Constructor Summary | |
---|---|
protected |
Attribute()
|
|
Attribute(ASN1Object ao)
This constructor builds an Attribute from ASN1Object. |
|
Attribute(java.lang.String type,
AttributeValue value)
This constructor builds an Attribute given its type and a single value. |
|
Attribute(java.lang.String type,
java.util.Vector values)
This constructor creates an Attribute of the given type and a set of values. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
void |
decode(ASN1Object ao)
This method decodes the given ASN1Object and sets this attribute type and value, as in ASN1Object. |
java.lang.String |
getType()
Returns the OID of the Attribute. |
java.util.Vector |
getValues()
Returns the vector of values of the attribute. |
static void |
registerAttribute(java.lang.String oid,
java.lang.Class attribute)
This method lets you register custom AttributeValue subclasses that will be used to decode values of specific attributes. |
void |
setType(java.lang.String type)
Sets the OID of the Attribute type. |
void |
setValues(java.util.Vector values)
Sets the vector of values of the attribute. |
ASN1Object |
toASN1Object()
This method returns the ASN1Object of this Attribute. |
java.lang.String |
toString()
|
java.lang.String |
toString(java.lang.String ident)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String type
protected java.util.Vector values
protected static java.util.Map registry
Constructor Detail |
---|
protected Attribute()
public Attribute(ASN1Object ao) throws CodingException
ao
- - the ASN1Object containing the Attribute
CodingException
public Attribute(java.lang.String type, java.util.Vector values)
type
- - the OID of the Attribute in dotted formvalues
- - the Vector of attribute values; each element must be of
AttributeValue class or its subclass; should not be null; in fact, the
standard requires that at least one element were presentpublic Attribute(java.lang.String type, AttributeValue value)
type
- - the OID of the Attribute in the dotted formvalue
- - the AttributeValue of the AttributeMethod Detail |
---|
public java.lang.String getType()
public void setType(java.lang.String type)
public java.util.Vector getValues()
public void setValues(java.util.Vector values)
values
- - the Vector of attribute values; each element must be of
AttributeValue class or a subclass of it.public ASN1Object toASN1Object() throws CodingException
CodingException
public void decode(ASN1Object ao) throws CodingException
You can register custom AttributeValue subclasses for decoding values of specific attribute types using registerAttribute method.
ao
- - the ASN1Object to decode; it must be a SEQUENCE of ObjectID and
a SET of AttributeValues
CodingException
registerAttribute(java.lang.String, java.lang.Class)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String ident)
public java.lang.Object clone()
clone
in class java.lang.Object
public static void registerAttribute(java.lang.String oid, java.lang.Class attribute)
...
Attribute.registerAttribute("1.2.3.4.5", MyCuteAttribute.class);
Now the constructor of your class will be invoked automatically whenever
the OID is encountered in
the attributes of an encoded AC.
oid
- is the dotted form of the OIDattribute
- is the class that will decode single attribute values;
must be a subclass of AttributeValue and must have a constructor with
ASN1Object as an argument
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |