org.bouncycastle.oer.its.etsi102941.SequenceOfCrlEntry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-jdk15to18 Show documentation
Show all versions of bcutil-jdk15to18 Show documentation
The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls. This jar contains APIs for JDK 1.5 to JDK 1.8.
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);
}
}
}