/*
- * Copyright 2011 BitMeister Inc.
+ * Copyright 2011-2012 BitMeister Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
package jp.bitmeister.asn1.type.builtin;
-import java.math.BigInteger;
-
import jp.bitmeister.asn1.annotation.ASN1BuiltIn;
import jp.bitmeister.asn1.annotation.ASN1Enumeration;
import jp.bitmeister.asn1.annotation.ASN1Tag;
import jp.bitmeister.asn1.type.ASN1TagMode;
/**
- * Represents ASN.1 'ENUMERATED' type.
+ * An implementation of ASN.1 'ENUMERATED' type that contains {@code Long}
+ * value.
*
* <p>
- * This is the base class used for defining 'ENUMERATED' types. A sub-class of
- * {@code ENUMERATED} must contain one or more fields annotated as
- * {@code @ASN1Enumeration}.
+ * This is the base class used for defining 'ENUMERATED' types, and has a
+ * {@link java.lang.Long} value. If the data needs to contain value which is
+ * bigger than {@code Long.MAX_VALUE} or smaller than {@code Long.MIN_VALUE},
+ * {@code BigENUMERATED} type shall be used. A sub-class of {@code ENUMERATED}
+ * must contain one or more fields annotated as {@code @ASN1Enumeration}.
* </p>
*
* @author WATANABE, Jun. <jwat at bitmeister.jp>
*
* @see ASN1Enumeration
+ * @see BigENUMERATED
*/
@ASN1BuiltIn
@ASN1Tag(tagClass = ASN1TagClass.UNIVERSAL, value = 10, tagMode = ASN1TagMode.IMPLICIT)
}
/**
- * Instantiates an {@code ENUMERATED} and initialize it with the
- * {@code BigInteger} value.
+ * Instantiates an {@code ENUMERATED} and initialize it with the {@code long}
+ * value.
*
* @param value
* The value to be assigned.
*/
- public ENUMERATED(BigInteger value) {
+ public ENUMERATED(long value) {
super(value);
}
-
+
/**
- * Instantiates an {@code ENUMERATED} and initialize it with the {@code long}
- * value.
+ * Instantiates an {@code ENUMERATED} and initialize it with the value that is
+ * specified by the identifier of namednumber.
*
- * @param value
- * The value to be assigned.
+ * @param identifier
+ * Identifier of the number to be assigned.
*/
- public ENUMERATED(long value) {
- super(value);
+ public ENUMERATED(String identifier) {
+ super(identifier);
}
/*
* .ASN1Visitor)
*/
@Override
- public <E extends Throwable> void accept(ASN1Visitor<E> visitor) throws E {
- visitor.visit(this);
+ public <R, E extends Throwable> R accept(ASN1Visitor<R, E> visitor) throws E {
+ return visitor.visit(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jp.bitmeister.asn1.type.AbstractInteger#isEnum()
+ */
+ @Override
+ protected boolean isEnum() {
+ return true;
}
}