directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject [14/26] directory-kerby git commit: DIRKRB-486 Dumping support for built-in ASN1 types and user defined types.
Date Mon, 07 Dec 2015 03:33:44 GMT
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/7c93f2e3/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
index 3c1c879..97f7b03 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/UserNotice.java
@@ -20,7 +20,9 @@
 package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
+import static org.apache.kerby.x509.type.UserNotice.MyEnum.*;
 
 /**
  *
@@ -33,8 +35,20 @@ import org.apache.kerby.asn1.type.Asn1SequenceType;
  *
  */
 public class UserNotice extends Asn1SequenceType {
-    private static final int NOTICE_REF = 0;
-    private static final int EXPLICIT_TEXT = 1;
+    protected static enum MyEnum implements EnumType {
+        NOTICE_REF,
+        EXPLICIT_TEXT;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
         new Asn1FieldInfo(NOTICE_REF, NoticeReference.class),

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/7c93f2e3/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
----------------------------------------------------------------------
diff --git a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
index 4964d29..e156206 100644
--- a/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
+++ b/kerby-pkix/src/main/java/org/apache/kerby/x509/type/V2Form.java
@@ -20,8 +20,10 @@
 package org.apache.kerby.x509.type;
 
 import org.apache.kerby.asn1.Asn1FieldInfo;
+import org.apache.kerby.asn1.EnumType;
 import org.apache.kerby.asn1.type.Asn1SequenceType;
 import org.apache.kerby.asn1.ExplicitField;
+import static org.apache.kerby.x509.type.V2Form.MyEnum.*;
 
 /**
  * Produce an object suitable for an ASN1OutputStream.
@@ -37,9 +39,21 @@ import org.apache.kerby.asn1.ExplicitField;
  * </pre>
  */
 public class V2Form extends Asn1SequenceType {
-    private static final int ISSUER_NAME = 0;
-    private static final int BASE_CERTIFICATE_ID = 1;
-    private static final int OBJECT_DIGEST_INFO = 2;
+    protected static enum MyEnum implements EnumType {
+        ISSUER_NAME,
+        BASE_CERTIFICATE_ID,
+        OBJECT_DIGEST_INFO;
+
+        @Override
+        public int getValue() {
+            return ordinal();
+        }
+
+        @Override
+        public String getName() {
+            return name();
+        }
+    }
 
     static Asn1FieldInfo[] fieldInfos = new Asn1FieldInfo[] {
         new Asn1FieldInfo(ISSUER_NAME, GeneralNames.class),


Mime
View raw message