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;
24 * Indicates identifier used for ASN.1 definition.
27 * If an {@code @ASN1Identifier} annotation is present on a type or a field,
28 * this value is used as ASN.1 identifier instead of their class name that taken
29 * by calling {@code Class.getSimpleName()} or field name that taken by calling
30 * {@code Field.getName()}. If an ASN.1 identifier can't be used for Java
31 * identifier because of syntax restriction, this annotation shall be used.
34 * For example, following ASN.1 definition :
37 * Signed-Number ::= SEQUENCE { -- '-' can't be used for identifier.
38 * int INTEGER -- 'int' is a reserved word.
42 * can be translated as :
45 * @ASN1Identifier("Signed-Number")
46 * public class Signed_Number extends SEQUENCE {
48 * @ASN1Identifier("int")
49 * @ASN1Element(0)
50 * public INTEGER _int;
57 * @author WATANABE, Jun. <jwat at bitmeister.jp>
59 @Target({ ElementType.TYPE, ElementType.FIELD })
60 @Retention(RetentionPolicy.RUNTIME)
61 public @interface ASN1Identifier {
64 * Indicates the identifier used in ASN.1 definitions.
66 * @return The ASN.1 identifier.
68 public String value();