TOC PREV NEXT INDEX


ENUMERATED



The ASN.1 ENUMERATED type is converted into a Java class that extends the Asn1Enumerated run-time class. This base class encapsulates the following public member variable:

    public int value;
 

This value is populated with one of the enumerated constant values that are generated by the compiler and added to the Java source file.

The following shows the basic mapping from ASN.1 type to Java class definition:

ASN.1 Production:
<name> ::= ENUMERATED { <e1>, <e2>, ..., <en> }


 
Generated Java class:

public class <name> extends Asn1Enumerated {
 
   public final static int <e1> = <v1>;
 
   public final static int <e2> = <v2>;
 
   ...
 
   public final static int <en> = <vn>;
 

 
   public <name> () {
 
      super();
 
   }
 
   public <name> (int value_) {
 
      super (value_);
 
   }
 
   public void decode () { ... }
 
   public int  encode () { ... }
 
   public void print () { ... }
 
}


 



Notes:


In the case of the enumerated type, encode/decode methods are always generated. These verify that the given value is within the defined set. An Asn1InvalidEnumException is thrown if the value is not in the defined set.

If an extensibility marker (...) is present in the ASN.1 definition, it will not affect the generated constants. A constant will be generated for all options - both root and extended. If the definition ends in a ... (what we call an `open extension'), then the generated decode function will be modified to not throw an Asn1InvalidEnumException. Instead, if the value is not in the defined set, it will set the value to the built-in base class constant Asn1Enumerated.UNDEFINED.


Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX

Copyright © 1997-2005 Objective Systems,Inc.
All Rights Reserved.


This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.