Package com.oss.asn1

Class AbstractData

java.lang.Object
com.oss.asn1.AbstractData
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AbstractBinary, AbstractCollection, AbstractContainer, AbstractISO8601Time, AbstractObjectIdentifier, AbstractOpenType, AbstractReal, AbstractString, AbstractTime, ASN1Type, BOOLEAN, Choice, Enumerated, HugeBinaryString, HugeContainer, HugeInteger, HugeRestrictedString, INTEGER, Null

public abstract class AbstractData extends Object implements Cloneable, Serializable
The AbstractData class represents the base class for all OSS ASN.1/Java universal classes.
Since:
ASN.1/Java 1.0-beta A
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Returned by compareTo() if the value of the object calling compareTo() is equal to the value of the object being passed to compareTo().
    static final int
    Returned by compareTo() if the value of the object calling compareTo() is greater than the value of the object being passed to compareTo().
    static final int
    Returned by compareTo() if the value of the object calling compareTo() is less than the value of the object being passed to compareTo().
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    The abstract method used to compare AbstractData objects for equality.
    Create a deep copy of 'this' object.
    void
    Destroy the instance of the AbstractData.
    boolean
    equals(Object that)
    Compares two objects for equality.
    Get the type descriptor (TypeInfo) of AbstractData objects.
    int
    Returns a hash code value of this object.
    boolean
    Tells if this AbstractData can be encoded/decoded.
    boolean
    Tells if this AbstractData represents a PDU.
    final boolean
    Provides constraint checking of 'this' object by calling methods from the validator package.
    final String
    Provides the conversion of 'this' object into the Java String object containing the ASN.1 value notation format.
    final String
    Provides the conversion of 'this' object into the Java String object containing the ASN.1 value notation format.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • LESS_THAN

      public static final int LESS_THAN
      Returned by compareTo() if the value of the object calling compareTo() is less than the value of the object being passed to compareTo().
      See Also:
    • EQUALS

      public static final int EQUALS
      Returned by compareTo() if the value of the object calling compareTo() is equal to the value of the object being passed to compareTo().
      See Also:
    • GREATER_THAN

      public static final int GREATER_THAN
      Returned by compareTo() if the value of the object calling compareTo() is greater than the value of the object being passed to compareTo().
      See Also:
  • Method Details

    • abstractEqualTo

      public abstract boolean abstractEqualTo(AbstractData that)
      The abstract method used to compare AbstractData objects for equality. This method allows you to compare the values of ASN.1/Java objects in an abstract manner, while preserving the compile-time type checking provided by the various equalTo() methods defined in the built-in classes (or their superclasses).
      Parameters:
      that - an object to compare 'this' object with.
      Returns:
      boolean value specifying whether or not contents of 'this' and 'that' objects are equal.
    • equals

      public boolean equals(Object that)
      Compares two objects for equality. Descendants of AbstractData also provide equalTo() method for comparing objects for equality in type-safe manner. The equalTo() methods provide more efficient solution for checking equality, so using equalTo() is recommended.
      Overrides:
      equals in class Object
      Parameters:
      that - an object to compare 'this' object with.
      Returns:
      boolean value specifying whether or not contents of 'this' and 'that' objects are equal.
    • getTypeInfo

      public TypeInfo getTypeInfo() throws MetadataException
      Get the type descriptor (TypeInfo) of AbstractData objects. This method is overridden in each generated class.
      Returns:
      reference to TypeInfo containing metadata information of 'this' object.
      Throws:
      MetadataException - if an error occurs when the metadata is accessed.
    • isValid

      public final boolean isValid() throws ValidateNotSupportedException, ValidateFailedException
      Provides constraint checking of 'this' object by calling methods from the validator package.
      Returns:
      boolean value specifying whether or not the value of 'this' object is valid.
      Throws:
      ValidateNotSupportedException - is thrown if validation is not supported
      ValidateFailedException - is thrown if validation fails
    • isEncodable

      public boolean isEncodable()
      Tells if this AbstractData can be encoded/decoded. Subclasses that implement data types, which are not eligible for encoding, must override this method to return false.
      Returns:
      true if the object may be encoded/decoded
    • isPDU

      public boolean isPDU()
      Tells if this AbstractData represents a PDU. Subclasses that implement data types, which are PDUs, must override this method to return true.
      Returns:
      true if the object is a PDU.
    • toString

      public final String toString()
      Provides the conversion of 'this' object into the Java String object containing the ASN.1 value notation format.
      Overrides:
      toString in class Object
      Returns:
      String containing the ASN.1 value notation of 'this' object.
    • toString

      public final String toString(ASN1ValueFormat fmt)
      Provides the conversion of 'this' object into the Java String object containing the ASN.1 value notation format. If the conversion is aborted due an error the method returns null.
      Parameters:
      fmt - specifies options to customize the format of the ASN.1 value notation.
      Returns:
      String containing the ASN.1 value notation of 'this' object.
    • clone

      public Object clone()
      Create a deep copy of 'this' object.
      Returns:
      copy of 'this' object.
    • delete

      public void delete()
      Destroy the instance of the AbstractData. The contract of this method is to facilitate garbage collection by explicit destruction of the data that is no longer needed.
    • hashCode

      public int hashCode()
      Returns a hash code value of this object. This method always return 0. This implementation of the hashCode() is provided in order to satisfy hashCode() method requirements in respect to the equals() method, that equal objects have the same hash code.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value of this object.