2 * Copyright 2011 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.BIT_STRING;
26 * Indicates that a field represents a named bit of a 'BIT STRING' type.
29 * If a field annotated as {@code @ASN1NamedBit} is present in a definition of
30 * sub-class of {@code BIT_STRING}, the value of the field is the index number
31 * of a distinguished bit in a bitstring value. An {@code @ASN1NamedBit} field
32 * must be a {@code public} {@code static} {@code final} field and the type
33 * shall be {@code int}. Each value of {@code @ASN1NamedBit} fields appearing in
34 * definition of a type must be distinct from the others.
37 * For example, following ASN.1 definition :
40 * Sample ::= BIT STRING { read(0), write(1) }
43 * can be translated as :
46 * public class Sample extends BIT_STRING {
49 * public static final int read = 0;
52 * public static final int write = 1;
59 * @author WATANABE, Jun. <jwat at bitmeister.jp>
63 @Target(ElementType.FIELD)
64 @Retention(RetentionPolicy.RUNTIME)
65 public @interface ASN1NamedBit {