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

org.bouncycastle.oer.its.SequenceOfPsidGroupPermissions 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 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.List;

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

/**
 * 
 *     SEQUENCE OF PsidGroupPermissions
 * 
*/ public class SequenceOfPsidGroupPermissions extends ASN1Object { private final List groupPermissions; public SequenceOfPsidGroupPermissions(List groupPermissions) { this.groupPermissions = Collections.unmodifiableList(groupPermissions); } public static SequenceOfPsidGroupPermissions getInstance(Object obj) { if (obj instanceof SequenceOfPsidGroupPermissions) { return (SequenceOfPsidGroupPermissions)obj; } ASN1Sequence sequence = ASN1Sequence.getInstance(obj); ArrayList psidGroupPermissions = new ArrayList(); Enumeration e = sequence.getObjects(); while (e.hasMoreElements()) { psidGroupPermissions.add(PsidGroupPermissions.getInstance(e.nextElement())); } return new Builder().setGroupPermissions(psidGroupPermissions).createSequenceOfPsidGroupPermissions(); } public static Builder builder() { return new Builder(); } public ASN1Primitive toASN1Primitive() { return new DERSequence(groupPermissions.toArray(new PsidGroupPermissions[0])); } public static class Builder { private List groupPermissions = new ArrayList(); public Builder setGroupPermissions(List groupPermissions) { this.groupPermissions.addAll(groupPermissions); return this; } public Builder addGroupPermission(PsidGroupPermissions... permissions) { this.groupPermissions.addAll(Arrays.asList(permissions)); return this; } public SequenceOfPsidGroupPermissions createSequenceOfPsidGroupPermissions() { return new SequenceOfPsidGroupPermissions(groupPermissions); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy