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.processor;
18 import jp.bitmeister.asn1.type.ASN1Type;
19 import jp.bitmeister.asn1.type.StringType;
20 import jp.bitmeister.asn1.type.TimeType;
21 import jp.bitmeister.asn1.type.UnknownType;
22 import jp.bitmeister.asn1.type.builtin.ANY;
23 import jp.bitmeister.asn1.type.builtin.BIT_STRING;
24 import jp.bitmeister.asn1.type.builtin.BOOLEAN;
25 import jp.bitmeister.asn1.type.builtin.CHOICE;
26 import jp.bitmeister.asn1.type.builtin.ENUMERATED;
27 import jp.bitmeister.asn1.type.builtin.INTEGER;
28 import jp.bitmeister.asn1.type.builtin.NULL;
29 import jp.bitmeister.asn1.type.builtin.OBJECT_IDENTIFIER;
30 import jp.bitmeister.asn1.type.builtin.OCTET_STRING;
31 import jp.bitmeister.asn1.type.builtin.REAL;
32 import jp.bitmeister.asn1.type.builtin.SEQUENCE;
33 import jp.bitmeister.asn1.type.builtin.SEQUENCE_OF;
34 import jp.bitmeister.asn1.type.builtin.SET;
35 import jp.bitmeister.asn1.type.builtin.SET_OF;
38 * Interface for classes which behave as visitor of ASN.1 types.
40 * @author WATANABE, Jun. <jwat at bitmeister.jp>
42 public interface ASN1Visitor<R, E extends Throwable> {
45 * Visits the {@code BOOLEAN} data.
48 * The data to be visited.
51 * When an error occured in the {@code accept} method.
53 public R visit(BOOLEAN data) throws E;
56 * Visits the {@code INTEGER} data.
59 * The data to be visited.
62 * When an error occured in the {@code accept} method.
64 public R visit(INTEGER data) throws E;
67 * Visits the {@code BIT_STRING} data.
70 * The data to be visited.
73 * When an error occured in the {@code accept} method.
75 public R visit(BIT_STRING data) throws E;
78 * Visits the {@code OCTET_STRING} data.
81 * The data to be visited.
84 * When an error occured in the {@code accept} method.
86 public R visit(OCTET_STRING data) throws E;
89 * Visits the {@code NULL} data.
92 * The data to be visited.
95 * When an error occured in the {@code accept} method.
97 public R visit(NULL data) throws E;
100 * Visits the {@code OBJECT_IDENTIFIER} data.
103 * The data to be visited.
106 * When an error occured in the {@code accept} method.
108 public R visit(OBJECT_IDENTIFIER data) throws E;
111 * Visits the {@code REAL} data.
114 * The data to be visited.
117 * When an error occured in the {@code accept} method.
119 public R visit(REAL data) throws E;
122 * Visits the {@code ENUMERATED} data.
125 * The data to be visited.
128 * When an error occured in the {@code accept} method.
130 public R visit(ENUMERATED data) throws E;
133 * Visits the {@code ANY} data.
136 * The data to be visited.
139 * When an error occured in the {@code accept} method.
141 public R visit(ANY data) throws E;
144 * Visits the {@code CHOICE} data.
147 * The data to be visited.
150 * When an error occured in the {@code accept} method.
152 public R visit(CHOICE data) throws E;
155 * Visits the {@code SEQUENCE_OF} data.
158 * The data to be visited.
161 * When an error occured in the {@code accept} method.
163 public R visit(SEQUENCE_OF<? extends ASN1Type> data) throws E;
166 * Visits the {@code SEQUENCE} data.
169 * The data to be visited.
172 * When an error occured in the {@code accept} method.
174 public R visit(SEQUENCE data) throws E;
177 * Visits the {@code SET_OF} data.
180 * The data to be visited.
183 * When an error occured in the {@code accept} method.
185 public R visit(SET_OF<? extends ASN1Type> data) throws E;
188 * Visits the {@code SET} data.
191 * The data to be visited.
194 * When an error occured in the {@code accept} method.
196 public R visit(SET data) throws E;
199 * Visits the {@code StringType} data.
202 * The data to be visited.
205 * When an error occured in the {@code accept} method.
207 public R visit(StringType data) throws E;
210 * Visits the {@code TimeType} data.
213 * The data to be visited.
216 * When an error occured in the {@code accept} method.
218 public R visit(TimeType data) throws E;
221 * Visits the {@code UnknownType} data.
224 * The data to be visited.
227 * When an error occured in the {@code accept} method.
229 public R visit(UnknownType data) throws E;