jp.bitmeister.asn1.type
Class SelectiveType

java.lang.Object
  extended by jp.bitmeister.asn1.type.ASN1Type
      extended by jp.bitmeister.asn1.type.StructuredType
          extended by jp.bitmeister.asn1.type.SelectiveType
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
CHOICE

public abstract class SelectiveType
extends StructuredType

The base class for structured types defined by referencing a list of distinct ASN.1 types.

This class provides generic interfaces and common methods for classes that represents structured types which defined by referencing a list of distinct ASN.1 types. This class is the parent class of {code CHOICE}.

Author:
WATANABE, Jun.
See Also:
CHOICE

Field Summary
 
Fields inherited from class jp.bitmeister.asn1.type.ASN1Type
stringBuilder
 
Constructor Summary
SelectiveType()
          Instantiates an empty SelectiveType.
SelectiveType(ASN1TagClass tagClass, int tagNumber, ASN1Type data)
          Instantiates a SelectiveType and initialize it with parameters.
SelectiveType(ASN1Type data)
          Instantiates a SelectiveType and initialize it with the parameter.
 
Method Summary
 NamedTypeSpecification alternative(ASN1TagClass tagClass, int tagNumber)
          Returns the element specified by the ASN.1 tag class and number.
 void clear()
          Clears the value of this ASN.1 data.
 void clearSelection()
          Clears the selection of this instance.
 java.lang.Object clone()
          Creates and returns a copy of this ASN.1 data.
 ASN1Type get(java.lang.String elementName)
          Gets the ASN.1 data from the element specified by the identifier of this instance.
 int hashCode()
          Returns a hash code value for this ASN.1 data.
 boolean hasValue()
          Tests if this ASN.1 data has value.
 boolean matches(ASN1TagClass tagClass, int tagNumber)
          Tests if the ASN.1 tag matches this ASN1 type.
 java.lang.String selectedIdentifier()
          Returns the identifier of selected alternative.
 ASN1TagValue selectedTag()
          Returns the ASN.1 tag of selected alternative.
 ASN1Type selectedValue()
          Returns the ASN.1 data of selected alternative.
 void set(NamedTypeSpecification alternative, ASN1Type data)
          Sets the ASN.1 data to the element specified by the NamedTypeSpecification of this instance.
 void set(java.lang.String elementName, ASN1Type component)
          Sets the ASN.1 data to the element specified by the identifier of this instance.
 boolean valueEquals(java.lang.Object other)
          Tests if the value of this ASN.1 data equals the value of the other ASN.1 data.
 
Methods inherited from class jp.bitmeister.asn1.type.ASN1Type
accept, equals, instantiate, specification, toString, validate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectiveType

public SelectiveType()
Instantiates an empty SelectiveType.


SelectiveType

public SelectiveType(ASN1Type data)
Instantiates a SelectiveType and initialize it with the parameter. The ASN.1 tag that assigned to the type of the data is used for select a field.

Parameters:
data - The ASN.1 data assigned to this instance.

SelectiveType

public SelectiveType(ASN1TagClass tagClass,
                     int tagNumber,
                     ASN1Type data)
Instantiates a SelectiveType and initialize it with parameters.

Parameters:
tagClass - The tag class used for select a field.
tagNumber - The tag number used for select a field.
data - The data to be assigned.
Method Detail

alternative

public NamedTypeSpecification alternative(ASN1TagClass tagClass,
                                          int tagNumber)
Returns the element specified by the ASN.1 tag class and number.

Parameters:
tagClass - ASN.1 tag class.
tagNumber - ASN.1 tag number.
Returns:
The element specified by the ASN.1 tag class and number.

matches

public boolean matches(ASN1TagClass tagClass,
                       int tagNumber)
Description copied from class: ASN1Type
Tests if the ASN.1 tag matches this ASN1 type.

Overrides:
matches in class ASN1Type
Parameters:
tagClass - The ASN.1 tag class.
tagNumber - The ASN.1 tag number.
Returns:
true when the tag class and the tag number matches this ASN.1 type.

set

public void set(NamedTypeSpecification alternative,
                ASN1Type data)
Description copied from class: StructuredType
Sets the ASN.1 data to the element specified by the NamedTypeSpecification of this instance.

Specified by:
set in class StructuredType
Parameters:
alternative - Indicates the element that the data to be assigned.
data - The data to be assigned.

set

public void set(java.lang.String elementName,
                ASN1Type component)
Description copied from class: StructuredType
Sets the ASN.1 data to the element specified by the identifier of this instance.

Specified by:
set in class StructuredType
Parameters:
elementName - The identifier of element.
component - The ASN.1 data to be assigned

get

public ASN1Type get(java.lang.String elementName)
Description copied from class: StructuredType
Gets the ASN.1 data from the element specified by the identifier of this instance.

Specified by:
get in class StructuredType
Parameters:
elementName - The identifier of element.
Returns:
The ASN.1 data of the element.

selectedValue

public ASN1Type selectedValue()
Returns the ASN.1 data of selected alternative.

Returns:
The ASN.1 data of selected alternative.

selectedIdentifier

public java.lang.String selectedIdentifier()
Returns the identifier of selected alternative.

Returns:
The identifier of selected alternative.

selectedTag

public ASN1TagValue selectedTag()
Returns the ASN.1 tag of selected alternative.

Returns:
The tag of selected alternative.

clearSelection

public void clearSelection()
Clears the selection of this instance.


clear

public void clear()
Description copied from class: ASN1Type
Clears the value of this ASN.1 data.

Specified by:
clear in class ASN1Type

hasValue

public boolean hasValue()
Description copied from class: ASN1Type
Tests if this ASN.1 data has value.

Specified by:
hasValue in class ASN1Type
Returns:
true when this ASN.1 data has value.

valueEquals

public boolean valueEquals(java.lang.Object other)
Description copied from class: ASN1Type
Tests if the value of this ASN.1 data equals the value of the other ASN.1 data. This method returns true when they have same value even if their types are different.

Specified by:
valueEquals in class ASN1Type
Parameters:
other - The ASN.1 data which to be compared.
Returns:
true when they have same value.

hashCode

public int hashCode()
Description copied from class: ASN1Type
Returns a hash code value for this ASN.1 data.

Specified by:
hashCode in class ASN1Type
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
Description copied from class: ASN1Type
Creates and returns a copy of this ASN.1 data. This method performs a 'deep copy' operation.

Specified by:
clone in class ASN1Type
See Also:
Object.clone()