OSDN Git Service

Version 0.11
[bm-asn1/bm-asn1.git] / jp / bitmeister / asn1 / processor / ASN1Visitor.java
1 /*
2  * Copyright 2011 BitMeister Inc.
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 package jp.bitmeister.asn1.processor;
17
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;
36
37 /**
38  * Interface for classes which behave as visitor of ASN.1 types.
39  * 
40  * @author WATANABE, Jun. <jwat at bitmeister.jp>
41  */
42 public interface ASN1Visitor<R, E extends Throwable> {
43
44         /**
45          * Visits the {@code BOOLEAN} data.
46          * 
47          * @param data
48          *            The data to be visited.
49          * @return Result.
50          * @throws E
51          *             When an error occured in the {@code accept} method.
52          */
53         public R visit(BOOLEAN data) throws E;
54
55         /**
56          * Visits the {@code INTEGER} data.
57          * 
58          * @param data
59          *            The data to be visited.
60          * @return Result.
61          * @throws E
62          *             When an error occured in the {@code accept} method.
63          */
64         public R visit(INTEGER data) throws E;
65
66         /**
67          * Visits the {@code BIT_STRING} data.
68          * 
69          * @param data
70          *            The data to be visited.
71          * @return Result.
72          * @throws E
73          *             When an error occured in the {@code accept} method.
74          */
75         public R visit(BIT_STRING data) throws E;
76
77         /**
78          * Visits the {@code OCTET_STRING} data.
79          * 
80          * @param data
81          *            The data to be visited.
82          * @return Result.
83          * @throws E
84          *             When an error occured in the {@code accept} method.
85          */
86         public R visit(OCTET_STRING data) throws E;
87
88         /**
89          * Visits the {@code NULL} data.
90          * 
91          * @param data
92          *            The data to be visited.
93          * @return Result.
94          * @throws E
95          *             When an error occured in the {@code accept} method.
96          */
97         public R visit(NULL data) throws E;
98
99         /**
100          * Visits the {@code OBJECT_IDENTIFIER} data.
101          * 
102          * @param data
103          *            The data to be visited.
104          * @return Result.
105          * @throws E
106          *             When an error occured in the {@code accept} method.
107          */
108         public R visit(OBJECT_IDENTIFIER data) throws E;
109
110         /**
111          * Visits the {@code REAL} data.
112          * 
113          * @param data
114          *            The data to be visited.
115          * @return Result.
116          * @throws E
117          *             When an error occured in the {@code accept} method.
118          */
119         public R visit(REAL data) throws E;
120
121         /**
122          * Visits the {@code ENUMERATED} data.
123          * 
124          * @param data
125          *            The data to be visited.
126          * @return Result.
127          * @throws E
128          *             When an error occured in the {@code accept} method.
129          */
130         public R visit(ENUMERATED data) throws E;
131
132         /**
133          * Visits the {@code ANY} data.
134          * 
135          * @param data
136          *            The data to be visited.
137          * @return Result.
138          * @throws E
139          *             When an error occured in the {@code accept} method.
140          */
141         public R visit(ANY data) throws E;
142
143         /**
144          * Visits the {@code CHOICE} data.
145          * 
146          * @param data
147          *            The data to be visited.
148          * @return Result.
149          * @throws E
150          *             When an error occured in the {@code accept} method.
151          */
152         public R visit(CHOICE data) throws E;
153
154         /**
155          * Visits the {@code SEQUENCE_OF} data.
156          * 
157          * @param data
158          *            The data to be visited.
159          * @return Result.
160          * @throws E
161          *             When an error occured in the {@code accept} method.
162          */
163         public R visit(SEQUENCE_OF<? extends ASN1Type> data) throws E;
164
165         /**
166          * Visits the {@code SEQUENCE} data.
167          * 
168          * @param data
169          *            The data to be visited.
170          * @return Result.
171          * @throws E
172          *             When an error occured in the {@code accept} method.
173          */
174         public R visit(SEQUENCE data) throws E;
175
176         /**
177          * Visits the {@code SET_OF} data.
178          * 
179          * @param data
180          *            The data to be visited.
181          * @return Result.
182          * @throws E
183          *             When an error occured in the {@code accept} method.
184          */
185         public R visit(SET_OF<? extends ASN1Type> data) throws E;
186
187         /**
188          * Visits the {@code SET} data.
189          * 
190          * @param data
191          *            The data to be visited.
192          * @return Result.
193          * @throws E
194          *             When an error occured in the {@code accept} method.
195          */
196         public R visit(SET data) throws E;
197
198         /**
199          * Visits the {@code StringType} data.
200          * 
201          * @param data
202          *            The data to be visited.
203          * @return Result.
204          * @throws E
205          *             When an error occured in the {@code accept} method.
206          */
207         public R visit(StringType data) throws E;
208
209         /**
210          * Visits the {@code TimeType} data.
211          * 
212          * @param data
213          *            The data to be visited.
214          * @return Result.
215          * @throws E
216          *             When an error occured in the {@code accept} method.
217          */
218         public R visit(TimeType data) throws E;
219
220         /**
221          * Visits the {@code UnknownType} data.
222          * 
223          * @param data
224          *            The data to be visited.
225          * @return Result.
226          * @throws E
227          *             When an error occured in the {@code accept} method.
228          */
229         public R visit(UnknownType data) throws E;
230
231 }