INTEGER

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

   public long value;

This is where the integer value to be encoded is stored. It also contains the result of a decode operation. Since it is public, it can be accessed directly to get or set the value. The generated constructors can also be used to set the value.

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

ASN.1 Production

   <name> ::= INTEGER

XSD Types

<xsd:integer>, <xsd:byte>, <xsd:short>, <xsd:int>, <xsd:long>, <xsd:unsignedByte>, <xsd:unsignedShort>, <xsd:unsignedInt>, <xsd:unsignedLong>, <xsd:positiveInt>, <xsd:nonPositiveInt>, <xsd:negativeInt>, <xsd:nonNegativeInt>

Generated Java class:

   public class <name> extends Asn1Integer {
      public <name> () {
         super();
      }
      public <name> (long value_) {
         super (value_);
      }
   }

This shows the class generated for a simple INTEGER assignment. If a tagged or constrained type is specified, specific encode and decode methods will be generated as well.