The getValueRange method has the following
signature:
public static boolean getValueRange (String elemName, Asn1ValueRange range)
The method returns true when the value range
range has been set by the method and
false when it has not been set. No exceptions are
thrown by this method.
The following ASN.1, taken from a slightly-modified version of the Employee sample program, provides a good example:
PersonnelRecord ::= [APPLICATION 0] IMPLICIT SET {
name Name,
title [0] IA5String,
number EmployeeNumber,
dateOfHire [1] Date,
nameOfSpouse [2] Name,
children [3] IMPLICIT SEQUENCE OF ChildInformation,
salary INTEGER (0..10000) OPTIONAL
}
The generated code is straightforward:
public static boolean getValueRange (String elemName, Asn1ValueRange range)
{
if (elemName.equals("salary")) {
range.min = 0;
range.max = 10000;
return true;
}
return false;
}