FileDocCategorySizeDatePackage
ASN1TypeCollection.javaAPI DocAndroid 1.5 API3292Wed May 06 22:41:06 BST 2009org.apache.harmony.security.asn1

ASN1TypeCollection

public abstract class ASN1TypeCollection extends ASN1Constructured
This abstract class represents ASN.1 type that is a collection of ASN.1 types.
see
ASN.1

Fields Summary
public final ASN1Type[]
type
public final boolean[]
OPTIONAL
public final Object[]
DEFAULT
Constructors Summary
public ASN1TypeCollection(int tagNumber, ASN1Type[] type)
Constructs ASN.1 collection type.

param
tagNumber - ASN.1 tag number
param
type - a collection of one or more ASN.1 types.
throws
IllegalArgumentException - if tagNumber is invalid

        super(tagNumber);
        // FIXME what about empty sequence?
        //        if (type.length == 0) {
        //            throw new ASN1Exception("ASN1 collection type: "
        //                    + getClass().getName()
        //                    + " MUST have at least one component");
        //        }

        this.type = type;
        this.OPTIONAL = new boolean[type.length];
        this.DEFAULT = new Object[type.length];
    
Methods Summary
protected voidgetValues(java.lang.Object object, java.lang.Object[] values)
Provides an object's values to be encoded Derived classes should override this method to provide encoding for a selected class of objects. The default implementation throws RuntimeException.

param
object - an object to be encoded
param
values - an array to store an object's values to be encoded

        throw new RuntimeException(Messages.getString("security.101", getClass().getName())); //$NON-NLS-1$
    
protected final voidsetDefault(java.lang.Object object, int index)
Sets a default value for a collection component. The component also became an optional component.

param
object - a component's default value
param
index - an index of a component

        OPTIONAL[index] = true;
        DEFAULT[index] = object;
    
protected final voidsetOptional(int index)
Sets a collection component as optional

param
index - an index of a component

        OPTIONAL[index] = true;