org.bouncycastle.oer.its.SequenceOfPsidSspRange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-jdk15on Show documentation
Show all versions of bcutil-jdk15on 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 and up.
The newest version!
package org.bouncycastle.oer.its;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
public class SequenceOfPsidSspRange
extends ASN1Object
{
private final List items;
public SequenceOfPsidSspRange(List items)
{
this.items = Collections.unmodifiableList(items);
}
public static SequenceOfPsidSspRange getInstance(Object o)
{
if (o instanceof SequenceOfPsidSspRange)
{
return (SequenceOfPsidSspRange)o;
}
ASN1Sequence sequence = ASN1Sequence.getInstance(o);
Enumeration e = sequence.getObjects();
ArrayList accumulator = new ArrayList();
while (e.hasMoreElements())
{
accumulator.add(PsidSspRange.getInstance(e.nextElement()));
}
return new SequenceOfPsidSspRange(accumulator);
}
public static Builder builder()
{
return new Builder();
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector avec = new ASN1EncodableVector();
for (Iterator it = items.iterator(); it.hasNext(); )
{
avec.add((ASN1Encodable)it.next());
}
return new DERSequence(avec);
}
public static class Builder
{
private ArrayList psidSspRanges = new ArrayList();
public Builder add(PsidSspRange... ranges)
{
psidSspRanges.addAll(Arrays.asList(ranges));
return this;
}
public SequenceOfPsidSspRange build()
{
return new SequenceOfPsidSspRange(psidSspRanges);
}
}
}