cryptix.asn1.lang

Interface ASNObject

public interface ASNObject extends Node

An interface that acts as the visible superclass of all components in parsed input files written in ASN.1.

This interface extends cryptix.asn1.lang.node which is generated by the JavaCC tool.

Author: Raif S. Naffah

See Also: Copyright ©1997, 1998, 1999 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.1 $

Method Summary
Objectaccept(ParserVisitor visitor, Object data)
Accepts a visitor.
voiddump()
Dumps this object's specification to System.out.
voiddump(String prefix)
Dumps this object's specification to System.out prefixing each line with the given string.
ASNObject[]getChildren()
ASNObjectgetComponent(String aName)
Returns a child component of an ASN.1 construct given its full name.
ObjectgetDefaultValue()
Similar to getValue() but operates on the default value of this ASN.1 object if such a value is/was defined in the specifications.
intgetID()
StringgetName()
ASNObjectgetParent()
TaggetTag()
Returns a reference to an instance of this ASN.1 object's Tag.
ObjectgetValue()
Returns the Java Object containing the current value of this ASN.1 object.
booleanisOptional()
Returns true if this ASN.1 object is optional, false otherwise.
voidsetDefaultValue(Object defaultValue)
Similar to setValue() but operates on the default value of this ASN.1 object if such a value is/was defined in the specifications.
voidsetOptional(boolean flag)
Sets the optional flag for this ASN.1 object to the designated value. param flag The new value of the optional flag.
voidsetTag(Tag tag)
Sets the tag of this ASN.1 object to be the designated instance. param tag A reference to an instance of Tag.
voidsetValue(Object value)
Sets the value of this component to a native Java instance.

The mapping between ASN.1 types and Java types is given below:

  1. BOOLEAN: java.lang.Boolean;
  2. INTEGER: java.math.BigInteger;
  3. BIT STRING: byte[];
  4. OCTET STRING: byte[];
  5. NULL: null;
  6. OID: A java.lang.String containing numeric digits and the character '.';
  7. SEQUENCE, SEQUENCE OF, SET and SET OF: cryptix.asn1.lang.ASNObject[];
  8. PrintableString: java.lang.String.

Method Detail

accept

public Object accept(ParserVisitor visitor, Object data)
Accepts a visitor.

Parameters: visitor An instance that implements the ParserVisitor interface.

Throws: IOException If an exception occurs during the application of the Visitor method.

See Also: ParserVisitor

dump

public void dump()
Dumps this object's specification to System.out.

dump

public void dump(String prefix)
Dumps this object's specification to System.out prefixing each line with the given string.

Parameters: prefix A string that will prefix each new line of the output.

getChildren

public ASNObject[] getChildren()

getComponent

public ASNObject getComponent(String aName)
Returns a child component of an ASN.1 construct given its full name. The name can be a sequence of strings separated by the character '.' to denote their hierarchy within the ASN.1 object; eg: for an X.509 encoded Certificate, one can get to the OID (the "algorithm") of the AlgorithmIdentifier (the "signature") included in the CertificateInfo part (the "certificateInfo") by passing the following as an argument to an X.509 ASNObject instance:
    "certificateInfo.signature.algorithm"
 

Returns: A child component of this ASN.1 object given its dotted name.

getDefaultValue

public Object getDefaultValue()
Similar to getValue() but operates on the default value of this ASN.1 object if such a value is/was defined in the specifications. If no such default value was defnied in the specifications then this method returns a null.

getID

public int getID()

getName

public String getName()

Returns: The name associated with this ASN.1 object.

getParent

public ASNObject getParent()

getTag

public Tag getTag()
Returns a reference to an instance of this ASN.1 object's Tag.

Returns: A reference to an instance of this ASN.1 object's Tag.

See Also: Tag

getValue

public Object getValue()
Returns the Java Object containing the current value of this ASN.1 object. For the mapping between ASN.1 values and Java types, see the setValue() method.

Returns: The value of this component as a native Java object.

See Also: ASNObject

isOptional

public boolean isOptional()
Returns true if this ASN.1 object is optional, false otherwise.

Returns: True if this ASN.1 object is optional, false otherwise.

setDefaultValue

public void setDefaultValue(Object defaultValue)
Similar to setValue() but operates on the default value of this ASN.1 object if such a value is/was defined in the specifications.

Parameters: defaultValue The Java object instance representing the default value of this ASN.1 object.

setOptional

public void setOptional(boolean flag)
Sets the optional flag for this ASN.1 object to the designated value. param flag The new value of the optional flag.

setTag

public void setTag(Tag tag)
Sets the tag of this ASN.1 object to be the designated instance. param tag A reference to an instance of Tag.

See Also: Tag

setValue

public void setValue(Object value)
Sets the value of this component to a native Java instance.

The mapping between ASN.1 types and Java types is given below:

  1. BOOLEAN: java.lang.Boolean;
  2. INTEGER: java.math.BigInteger;
  3. BIT STRING: byte[];
  4. OCTET STRING: byte[];
  5. NULL: null;
  6. OID: A java.lang.String containing numeric digits and the character '.';
  7. SEQUENCE, SEQUENCE OF, SET and SET OF: cryptix.asn1.lang.ASNObject[];
  8. PrintableString: java.lang.String.