org.bouncycastle.oer.SwitchIndexer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-jdk18on Show documentation
Show all versions of bcutil-jdk18on 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.8 and up.
package org.bouncycastle.oer;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Sequence;
public abstract class SwitchIndexer
{
public abstract ASN1Encodable get(int index);
public static class Asn1SequenceIndexer
extends SwitchIndexer
{
private final ASN1Sequence sequence;
public Asn1SequenceIndexer(ASN1Sequence sequence)
{
this.sequence = sequence;
}
@Override
public ASN1Encodable get(int index)
{
return sequence.getObjectAt(index);
}
}
public static class Asn1EncodableVectorIndexer
extends SwitchIndexer
{
private final ASN1EncodableVector asn1EncodableVector;
public Asn1EncodableVectorIndexer(ASN1EncodableVector asn1EncodableVector)
{
this.asn1EncodableVector = asn1EncodableVector;
}
@Override
public ASN1Encodable get(int index)
{
return asn1EncodableVector.get(index);
}
}
public static class FixedValueIndexer
extends SwitchIndexer
{
private final ASN1Encodable returnValue;
public FixedValueIndexer(ASN1Encodable returnValue)
{
this.returnValue = returnValue;
}
@Override
public ASN1Encodable get(int index)
{
return returnValue;
}
}
}