cryptix.asn1.lang

Interface ASNObject

All Superinterfaces:
Node
Known Implementing Classes:
ASNAny, ASNBitString, ASNBoolean, ASNInteger, ASNNull, ASNObjectIdentifier, ASNOctetString, ASNPrintableString, ASNSequence, ASNSequenceOf, ASNSet, ASNSetOf, ASNSpecification, ASNTaggedType, ASNTime, ASNType, ASNTypeAlias, SimpleNode

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:
cryptix.asn1.lang.Node Copyright ©1997, 1998, 1999 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.1 $

Method Summary

Object
accept(ParserVisitor visitor, Object data)
Accepts a visitor.
void
dump()
Dumps this object's specification to System.out.
void
dump(String prefix)
Dumps this object's specification to System.out prefixing each line with the given string.
ASNObject[]
getChildren()
ASNObject
getComponent(String aName)
Returns a child component of an ASN.1 construct given its full name.
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.
int
getID()
String
getName()
ASNObject
getParent()
Tag
getTag()
Returns a reference to an instance of this ASN.1 object's Tag.
Object
getValue()
Returns the Java Object containing the current value of this ASN.1 object.
boolean
isOptional()
Returns true if this ASN.1 object is optional, false otherwise.
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.
void
setOptional(boolean flag)
Sets the optional flag for this ASN.1 object to the designated value.
void
setTag(Tag tag)
Sets the tag of this ASN.1 object to be the designated instance.
void
setValue(Object value)
Sets the value of this component to a native Java instance.

Methods inherited from interface cryptix.asn1.lang.Node

jjtAccept, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent

Method Details

accept

public Object accept(ParserVisitor visitor,
                     Object data)
            throws IOException
Accepts a visitor.
Parameters:
visitor - An instance that implements the ParserVisitor interface.
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.

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.