All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.oer.its.etsi102941.SequenceOfCrlEntry Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls. This jar contains APIs for Java 8 and later.

There is a newer version: 2.73.6
Show newest version
package org.bouncycastle.oer.its.etsi102941;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;


public class SequenceOfCrlEntry
    extends ASN1Object
{
    private final List crlEntries;

    public SequenceOfCrlEntry(List crlEntries)
    {
        this.crlEntries = Collections.unmodifiableList(crlEntries);
    }

    private SequenceOfCrlEntry(ASN1Sequence sequence)
    {
        List items = new ArrayList();
        for (Iterator it = sequence.iterator(); it.hasNext(); )
        {
            items.add(CrlEntry.getInstance(it.next()));
        }
        this.crlEntries = Collections.unmodifiableList(items);
    }

    public static Builder builder()
    {
        return new Builder();
    }

    public static SequenceOfCrlEntry getInstance(Object o)
    {
        if (o instanceof SequenceOfCrlEntry)
        {
            return (SequenceOfCrlEntry)o;
        }
        if (o != null)
        {
            return new SequenceOfCrlEntry(ASN1Sequence.getInstance(o));
        }

        return null;
    }

    public List getCrlEntries()
    {
        return crlEntries;
    }

    @Override
    public ASN1Primitive toASN1Primitive()
    {
        return new DERSequence(crlEntries.toArray(new ASN1Encodable[0]));
    }

    public static class Builder
    {
        private final List items = new ArrayList();

        public Builder addCrlEntry(CrlEntry... items)
        {
            this.items.addAll(Arrays.asList(items));
            return this;
        }

        public SequenceOfCrlEntry build()
        {
            return new SequenceOfCrlEntry(items);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy