org.bouncycastle.oer.its.SequenceOfPsidSsp 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.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;
/**
* SequenceOfPsidSsp ::= SEQUENCE OF PsidSsp
*/
public class SequenceOfPsidSsp
extends ASN1Object
{
private final List items;
public SequenceOfPsidSsp(List items)
{
this.items = Collections.unmodifiableList(items);
}
public static SequenceOfPsidSsp getInstance(Object o)
{
if (o instanceof SequenceOfPsidSsp)
{
return (SequenceOfPsidSsp)o;
}
ASN1Sequence sequence = ASN1Sequence.getInstance(o);
Enumeration e = sequence.getObjects();
ArrayList accumulator = new ArrayList();
while (e.hasMoreElements())
{
accumulator.add(PsidSsp.getInstance(e.nextElement()));
}
return new Builder().setItems(accumulator).createSequenceOfPsidSsp();
}
public static Builder builder()
{
return new Builder();
}
public List getItems()
{
return items;
}
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 List items = new ArrayList();
public Builder setItems(List items)
{
this.items = items;
return this;
}
public Builder setItem(PsidSsp... items)
{
for (int i = 0; i != items.length; i++)
{
PsidSsp item = items[i];
this.items.add(item);
}
return this;
}
public SequenceOfPsidSsp createSequenceOfPsidSsp()
{
return new SequenceOfPsidSsp(items);
}
}
}