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 ... notation used in the ASN.1 definition above does not represent the ASN.1 extensibility notation. It is used to show a continuation of the enumerated sequence of values.
- The <e1>, <e2>, etc. items denote enumerated constants. These can be in identifier only format or identifier(value) format. The <v1>, <v2>, etc. items denote the enumerated values. These are sequential numbers starting at zero if no values are provided. Otherwise, the actual enumerated values are used.
- The public methods that are generated are shown without arguments or function bodies for brevity.
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 #506Exton, 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 |