OSDN Git Service

Bug fix on XerEncoder.
[bm-asn1/bm-asn1.git] / jp / bitmeister / asn1 / type / builtin / ENUMERATED.java
1 /*
2  * Copyright 2011 BitMeister Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package jp.bitmeister.asn1.type.builtin;
17
18 import java.math.BigInteger;
19
20 import jp.bitmeister.asn1.annotation.ASN1BuiltIn;
21 import jp.bitmeister.asn1.annotation.ASN1Enumeration;
22 import jp.bitmeister.asn1.annotation.ASN1Tag;
23 import jp.bitmeister.asn1.processor.ASN1Visitor;
24 import jp.bitmeister.asn1.type.ASN1TagClass;
25 import jp.bitmeister.asn1.type.ASN1TagMode;
26
27 /**
28  * Represents ASN.1 'ENUMERATED' type.
29  * 
30  * <p>
31  * This is the base class used for defining 'ENUMERATED' types. A sub-class of
32  * {@code ENUMERATED} must contain one or more fields annotated as
33  * {@code @ASN1Enumeration}.
34  * </p>
35  * 
36  * @author WATANABE, Jun. <jwat at bitmeister.jp>
37  * 
38  * @see ASN1Enumeration
39  */
40 @ASN1BuiltIn
41 @ASN1Tag(tagClass = ASN1TagClass.UNIVERSAL, value = 10, tagMode = ASN1TagMode.IMPLICIT)
42 public abstract class ENUMERATED extends INTEGER {
43
44         /**
45          * Instantiates an empty {@code ENUMERATED}.
46          */
47         public ENUMERATED() {
48         }
49
50         /**
51          * Instantiates an {@code ENUMERATED} and initialize it with the
52          * {@code BigInteger} value.
53          * 
54          * @param value
55          *            The value to be assigned.
56          */
57         public ENUMERATED(BigInteger value) {
58                 super(value);
59         }
60
61         /**
62          * Instantiates an {@code ENUMERATED} and initialize it with the {@code long}
63          * value.
64          * 
65          * @param value
66          *            The value to be assigned.
67          */
68         public ENUMERATED(long value) {
69                 super(value);
70         }
71
72         /*
73          * (non-Javadoc)
74          * 
75          * @see
76          * jp.bitmeister.asn1.type.builtin.INTEGER#accept(jp.bitmeister.asn1.processor
77          * .ASN1Visitor)
78          */
79         @Override
80         public <R, E extends Throwable> R accept(ASN1Visitor<R, E> visitor) throws E {
81                 return visitor.visit(this);
82         }
83
84 }