1 /*
2  * Copyright (C) 2017 The Android Open Source Project
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 
17 package com.android.apksig.internal.asn1;
18 
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23 
24 @Target({ElementType.FIELD})
25 @Retention(RetentionPolicy.RUNTIME)
26 public @interface Asn1Field {
27     /** Index used to order fields in a container. Required for fields of SEQUENCE containers. */
index()28     public int index() default 0;
29 
cls()30     public Asn1TagClass cls() default Asn1TagClass.AUTOMATIC;
31 
type()32     public Asn1Type type();
33 
34     /** Tagging mode. Default: NORMAL. */
tagging()35     public Asn1Tagging tagging() default Asn1Tagging.NORMAL;
36 
37     /** Tag number. Required when IMPLICIT and EXPLICIT tagging mode is used.*/
tagNumber()38     public int tagNumber() default -1;
39 
40     /** {@code true} if this field is optional. Ignored for fields of CHOICE containers. */
optional()41     public boolean optional() default false;
42 
43     /** Type of elements. Used only for SET_OF or SEQUENCE_OF. */
elementType()44     public Asn1Type elementType() default Asn1Type.ANY;
45 }
46