Each generated Java class will have two constructors. The first constructor will be the default constructor. This will initialize each member variable value to null. The second constructor will accept values for all the data members.
Example
As an example, consider the following ASN.1 class definition :
ATTRIBUTE ::= CLASS { &Type, &id OBJECT IDENTIFIER UNIQUE } WITH SYNTAX { WITH SYNTAX &Type ID &id }
A file named ATTRIBUTE.java is generated with following definition:
public class ATTRIBUTE { public Asn1Type Type; public Asn1ObjectIdentifier id; public ATTRIBUTE() { Type = null; id = null; } public ATTRIBUTE( Asn1Type Type_, Asn1ObjectIdentifier id_ ) { Type = Type_; id = id_; } }
NOTE: If the ASN.1 type name is same as the ASN.1 class name (ignoring case) in a single module definition, then the ASN.1 class name will be changed to following:
<ClassName>_CLASS
In this definition, <ClassName> would be replaced with the name of the ASN.1 CLASS and the literal token "_CLASS" would be appended.
For example:
Test DEFINITION ::= BEGIN Attribute ::= INTEGER ATTRIBUTE ::= ABSTRACT-SYNTAX END
ASN1C will change the ATTRIBUTE class name to ATTRIBUTE_CLASS to avoid conflicts with the Attribute type.
This automated feature will help users to successfully compile the generated code without having to manually change the name via a configuration file setting.
Additional Java classes are generated to create types for fields within the class definitions as follows:
New type assignments are created for TypeField type definitions as follows:
_<ClassName>_<FieldName> ::= <Type>
Here ClassName is replaced with name of the Class Assignment and FieldName is replaced with name of the field. Type is the type definition in the ASN.1 CLASS's TypeField.
This type is used as a defined type in the information object definition for absent values of the TypeField. It is also useful for the user to generate a value for a related OpenType definition in a table constraint.
New type assignments are created for ValueField or ValueSetField type definitions if the type is with a constraint definition and/or the type is Sequence / Set / Choice / Sequenceof / SetOf definition.
_<ClassName>_<FieldName> ::= <Type>
Here ClassName is replaced with name of the Class Assignment and FieldName is replaced with name of the ValueField or ValueSetField. Type is the type definition in The ASN.1 CLASS's ValueField or ValueSetField. This type will appear as a defined type in the ASN.1 CLASS's ValueField or ValueSetField.
This new type assignment is used for compiler internal code generation purpose. It is not designed for use by the end user.
New value assignments are created for ValueField default value definitions as follows:
_<ClassName>_<FieldName>_default <Type> ::= <Value>
Here ClassName is replaced with name of the Class Assignment and FieldName is replaced with name of the ValueField. Value is the default value in the ASN.1 CLASS's ValueField & Type is the type in the ASN.1 CLASS's ValueField.
This value is used as a defined value in the information object definition for an absent value of the field. This new value assignment is used for compiler internal code generation purpose. It is not designed for use by the end user.