Class ASN1EnumBase<T extends Enum<T> & EnumWithIntegerValue>
java.lang.Object
org.bouncycastle.asn1.ASN1Object
paccor.tcg.credential.ASN1EnumBase<T>
- Type Parameters:
T- An enum that implements EnumWithValue
- All Implemented Interfaces:
org.bouncycastle.asn1.ASN1Encodable, org.bouncycastle.util.Encodable
- Direct Known Subclasses:
ASN1BitStringEnumBase, ASN1EnumeratedEnumBase
public abstract class ASN1EnumBase<T extends Enum<T> & EnumWithIntegerValue>
extends org.bouncycastle.asn1.ASN1Object
Common functionality for usage of Java Enums with BC ASN1Objects that can be identified by an integer value
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceASN1EnumBase.Factory<T extends Enum<T> & EnumWithIntegerValue, U extends ASN1EnumBase<T>>Create instances and manage ASN.1 conversion. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T> & EnumWithIntegerValue, U extends ASN1EnumBase<T>>
UfromJsonNode(@NonNull tools.jackson.databind.JsonNode jsonNode, @NonNull Class<T> enumType, @NonNull ASN1EnumBase.Factory<T, U> factory) Get Instance from JsonNodegetEnum()Look up the enum object by value.static <T extends Enum<T> & EnumWithIntegerValue, U extends ASN1EnumBase<T>>
UgetInstance(Object obj, @NonNull ASN1EnumBase.Factory<T, U> factory) Get Instance.abstract org.bouncycastle.asn1.ASN1PrimitiveConverts the value to its ASN.1 representation.Methods inherited from class org.bouncycastle.asn1.ASN1Object
encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode
-
Constructor Details
-
ASN1EnumBase
public ASN1EnumBase()
-
-
Method Details
-
getInstance
public static <T extends Enum<T> & EnumWithIntegerValue, U extends ASN1EnumBase<T>> U getInstance(Object obj, @NonNull @NonNull ASN1EnumBase.Factory<T, U> factory) Get Instance.- Type Parameters:
T- Java enum type that implements EnumWithValue.U- Type relevant to <T> that extends AbstractEnumWithASN1Value.- Parameters:
obj- Input objectfactory- Utility to convert values.- Returns:
- U
-
fromJsonNode
public static <T extends Enum<T> & EnumWithIntegerValue, U extends ASN1EnumBase<T>> U fromJsonNode(@NonNull @NonNull tools.jackson.databind.JsonNode jsonNode, @NonNull @NonNull Class<T> enumType, @NonNull @NonNull ASN1EnumBase.Factory<T, U> factory) Get Instance from JsonNode- Type Parameters:
T- Java enum type that implements EnumWithValue.U- Type relevant to <T> that extends AbstractEnumWithASN1Value.- Parameters:
jsonNode- json objectenumType- Target enum class.factory- Utility to convert values.- Returns:
- U
-
toASN1Primitive
public abstract org.bouncycastle.asn1.ASN1Primitive toASN1Primitive()Converts the value to its ASN.1 representation.- Specified by:
toASN1Primitivein interfaceorg.bouncycastle.asn1.ASN1Encodable- Specified by:
toASN1Primitivein classorg.bouncycastle.asn1.ASN1Object- Returns:
- value as ASN1Primitive
-
getEnum
Look up the enum object by value.- Returns:
- The Enum object in T that corresponds with the value.
-