2 * Copyright 2011-2012 BitMeister Inc.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package jp.bitmeister.asn1.annotation;
18 import java.lang.annotation.ElementType;
19 import java.lang.annotation.Retention;
20 import java.lang.annotation.RetentionPolicy;
21 import java.lang.annotation.Target;
23 import jp.bitmeister.asn1.type.builtin.ENUMERATED;
24 import jp.bitmeister.asn1.type.builtin.INTEGER;
27 * Indicates that a field is an element of enumerations.
30 * If a field annotated as {@code @ASN1Enumeration} is present in a definition
31 * of a sub-class of {@code INTEGER} or {@code ENUMERATED}, value that can be
32 * contained in the type is limited to values of {@code @ASN1Enumeration}
33 * fields. An {@code @ASN1Enumeration} field must be a {@code public}
34 * {@code static} {@code final} field and the type shall be {@code int},
35 * {@code long} or {@code BigInteger}. Each value of {@code @ASN1Enumeration}
36 * fields appearing in definition of a type must be distinct from the others. A
37 * sub-class of {@code ENUMERATED} must have at least one
38 * {@code @ASN1Enumeration} field.
41 * For example, following ASN.1 definition :
44 * Sample ::= ENUMERATED {
49 * can be translated as :
52 * public class Sample extends ENUMERATED {
54 * @ASN1Enumeration
55 * public static final int zero = 0;
57 * @ASN1Enumeration
58 * public static final int one = 1;
65 * @author WATANABE, Jun. <jwat at bitmeister.jp>
70 @Target(ElementType.FIELD)
71 @Retention(RetentionPolicy.RUNTIME)
72 public @interface ASN1Enumeration {