Class TypeInfo

java.lang.Object
com.oss.metadata.TypeInfo
Direct Known Subclasses:
CollectionInfo, DeferredComponentInfo, EnumeratedInfo, IntegerInfo, OpenTypeInfo, RealInfo, TimeInfo, VectorInfo

public class TypeInfo extends Object
The TypeInfo class represents the properties of generic ASN.1 types.

Every ASN.1 type has:

  • tags,
  • a Java class to represent it,
  • an ASN.1 name (module name and typereference),
  • flags to mark certain properties of the type such as extensibility etc., and
  • constraints imposed on the type values.
The TypeInfo class contains all of these properties which are common to all ASN.1 types. Specific ASN.1 types, such as INTEGER, may require additional data items, so subclasses of the TypeInfo, such as IntegerInfo, are used to describe the properties particular to those types.

The TypeInfo class by itself is used to represent type descriptors of the ASN.1 BOOLEAN, NULL and REAL types. That is only these types do not require additional metadata information.

Since:
ASN.1/Java 2.1
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an instance of a Java class that implements an ASN.1 type, described by the TypeInfo.
    Returns an instance of a Java class that implements an ASN.1 type, described by the TypeInfo.
    static TypeInfo
    forName(String className)
    Returns the TypeInfo object associated with the subclass of AbstractData with the given string name.
    static TypeInfo
    forName(String className, Object context)
    Returns the TypeInfo object associated with the subclass of AbstractData with the given string name.
    Returns the name of the ASN.1 module where this type has been defined.
    Returns the ASN.1 type name for the type.
    Returns a fully qualified name of the Java class associated with the type.
    Returns a list of constraints defined for this type.
    Returns the class object for the Java class associated with the type.
    Returns the class object for the Java class associated with the type.
    Returns the ASN.1 module and type name.
    Returns the tags for the class
    boolean
    Returns true if the type is defined as extensible, and false otherwise.
    boolean
    Indicates if 'null' JSON encoder option is permitted for this type when it occurs as OPTIONAL component nested within a SEQUENCE or SET.
    boolean
    Returns true if the type is a primitive type.
    boolean
    Return true if the type is a simple type.
    boolean
    Return true if SetInfo fields are sorted in canonical order.
    boolean
    Returns true if BER coding can be performed with this type, false otherwise.
    boolean
    Returns true if CER coding can be performed with this type, false otherwise.
    boolean
    Returns true if DER coding can be performed with this type, false otherwise.
    boolean
    Returns true if EXER coding can be performed with this type, false otherwise.
    boolean
    Returns true if JSON coding can be performed with this type, false otherwise.
    boolean
    Returns true if OER coding can be performed with this type, false otherwise.
    boolean
    Returns true if PER coding can be performed with this type, false otherwise.
    boolean
    Returns true if XER coding can be performed with this type, false otherwise.
    boolean
    Return true if UserClass directive was applied to the type.
    static boolean
    Return true if thread context class loader is used to load classes, or false if default class loader is used.
    static void
    The method is used for specifying class loader that will be used to load compiler-generated classes at runtime.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • forName

      public static TypeInfo forName(String className) throws MetadataException
      Returns the TypeInfo object associated with the subclass of AbstractData with the given string name.
      Parameters:
      className - the fully qualified name of the desired class
      Returns:
      TypeInfo
      Throws:
      MetadataException - if attempt to extract the TypeInfo fails: class could not be found or TypeInfo was not available.
    • forName

      public static TypeInfo forName(String className, Object context) throws MetadataException
      Returns the TypeInfo object associated with the subclass of AbstractData with the given string name.
      Parameters:
      className - the fully qualified name of the desired class
      context - project environment
      Returns:
      TypeInfo
      Throws:
      MetadataException - if attempt to extract the TypeInfo fails: class could not be found or TypeInfo was not available.
    • getTags

      public Tags getTags()
      Returns the tags for the class
      Returns:
      the tags for the class
    • getClassName

      public String getClassName()
      Returns a fully qualified name of the Java class associated with the type.
      Returns:
      a fully qualified name of the Java class associated with the type.
    • getJavaClass

      public Class getJavaClass() throws ClassNotFoundException
      Returns the class object for the Java class associated with the type.
      Returns:
      the class object for the Java class associated with the type.
      Throws:
      ClassNotFoundException - if it could not find definition of the class
    • getJavaClass

      public Class getJavaClass(Object context) throws ClassNotFoundException
      Returns the class object for the Java class associated with the type.
      Parameters:
      context - project environment
      Returns:
      the class object for the Java class associated with the type.
      Throws:
      ClassNotFoundException - if it could not find definition of the class
    • getName

      public String getName()
      Returns the ASN.1 module and type name. If the name is not found then the literal string: "Module.Type" is used.
      Returns:
      the ASN.1 name for the type in the form Modulename.Typename.
    • getASN1TypeName

      public String getASN1TypeName()
      Returns the ASN.1 type name for the type. The module name is not included. Use getName() if you want to include the module name.
      Returns:
      the ASN.1 name for the type (not including the module name).
    • getASN1ModuleName

      public String getASN1ModuleName()
      Returns the name of the ASN.1 module where this type has been defined.
      Returns:
      the name of the ASN.1 module where this type has been defined.
    • isExtensible

      public boolean isExtensible()
      Returns true if the type is defined as extensible, and false otherwise.
      Returns:
      true if the type is defined as extensible in the ASN.1 spec.
    • isPrimitive

      public boolean isPrimitive()
      Returns true if the type is a primitive type.
      Returns:
      true if the type is primitive (i.e if it is encoded using definite length form in BER).
    • isUseableByPER

      public boolean isUseableByPER()
      Returns true if PER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform PER coding
    • isUseableByBER

      public boolean isUseableByBER()
      Returns true if BER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform BER coding
    • isUseableByXER

      public boolean isUseableByXER()
      Returns true if XER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform XER coding
    • isUseableByEXER

      public boolean isUseableByEXER()
      Returns true if EXER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform EXER coding
    • isUseableByDER

      public boolean isUseableByDER()
      Returns true if DER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform DER coding
    • isUseableByCER

      public boolean isUseableByCER()
      Returns true if CER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform CER coding
    • isUseableByOER

      public boolean isUseableByOER()
      Returns true if OER coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform OER coding
    • isUseableByJSON

      public boolean isUseableByJSON()
      Returns true if JSON coding can be performed with this type, false otherwise.
      Returns:
      true if the type descriptor has enough information to perform JSON coding
    • isNullable

      public boolean isNullable()
      Indicates if 'null' JSON encoder option is permitted for this type when it occurs as OPTIONAL component nested within a SEQUENCE or SET. The 'null' encoder option permits the JSON encoder to include an additional member in the encoding of a SEQUENCE or a SET for each optional component whose type is neither the null type nor an open type and which is absent in the sequence value. The Unicode character string denoted by the name of the member shall be the identifier of the component and the value of the member shall be the JSON token null.
      Returns:
      true if the 'null' encoder option is permitted.
    • isSorted

      public boolean isSorted()
      Return true if SetInfo fields are sorted in canonical order.
      Returns:
      true if SET fields in metadata are sorted in canonical tag order.
    • isUserClass

      public boolean isUserClass()
      Return true if UserClass directive was applied to the type.
      Returns:
      true if UserClass directive was applied to the type.
    • isSimpleType

      public boolean isSimpleType()
      Return true if the type is a simple type. The type is simple if it is not a set, sequence, set-of, sequence-of, choice, embedded-pdv, external or unrestricted character string type.
      Returns:
      true if the type is a simple type.
    • getConstraints

      public Constraints getConstraints()
      Returns a list of constraints defined for this type.
      Returns:
      list of imposed constraints.
    • createInstance

      Returns an instance of a Java class that implements an ASN.1 type, described by the TypeInfo.
      Returns:
      an instance of Java class that implements an ASN.1 type, described by the TypeInfo.
      Throws:
      ClassNotFoundException - if it could not find definition of the class
      InstantiationException - if an application tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason
      IllegalAccessException - if the class or initializer is not accessible
    • createInstance

      Returns an instance of a Java class that implements an ASN.1 type, described by the TypeInfo.
      Parameters:
      context - project environment
      Returns:
      an instance of Java class that implements an ASN.1 type, described by the TypeInfo.
      Throws:
      ClassNotFoundException - if it could not find definition of the class
      InstantiationException - if an application tries to instantiate an abstract class or an interface, or if the instantiation fails for some other reason
      IllegalAccessException - if the class or initializer is not accessible
    • isUseThreadContextClassLoader

      public static boolean isUseThreadContextClassLoader()
      Return true if thread context class loader is used to load classes, or false if default class loader is used.
      Returns:
      true if thread context class loader is used.
    • setUseThreadContextClassLoader

      public static void setUseThreadContextClassLoader(boolean flag)
      The method is used for specifying class loader that will be used to load compiler-generated classes at runtime. By default the class loader that was used to load current typeinfo class is used. That is also specified by passing 'false' flag parameter value to the method call. Passing 'true' flag parameter to the method call specifies that thread context class loader will be used.
      Parameters:
      flag - indication of whether to use thread context class loader when loading classes.