001: /***
002: * ASM: a very small and fast Java bytecode manipulation framework
003: * Copyright (c) 2000-2005 INRIA, France Telecom
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions
008: * are met:
009: * 1. Redistributions of source code must retain the above copyright
010: * notice, this list of conditions and the following disclaimer.
011: * 2. Redistributions in binary form must reproduce the above copyright
012: * notice, this list of conditions and the following disclaimer in the
013: * documentation and/or other materials provided with the distribution.
014: * 3. Neither the name of the copyright holders nor the names of its
015: * contributors may be used to endorse or promote products derived from
016: * this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
028: * THE POSSIBILITY OF SUCH DAMAGE.
029: */package org.ejb3unit.asm.signature;
030:
031: /**
032: * A visitor to visit a generic signature. The methods of this interface must be
033: * called in one of the three following orders (the last one is the only valid
034: * order for a {@link SignatureVisitor} that is returned by a method of this
035: * interface):
036: * <ul>
037: * <li><i>ClassSignature</i> = ( <tt>visitFormalTypeParameter</tt>
038: * <tt>visitClassBound</tt>?
039: * <tt>visitInterfaceBound</tt>* )* ( <tt>visitSuperClass</tt>
040: * <tt>visitInterface</tt>* )</li>
041: * <li><i>MethodSignature</i> = ( <tt>visitFormalTypeParameter</tt>
042: * <tt>visitClassBound</tt>?
043: * <tt>visitInterfaceBound</tt>* )* ( <tt>visitParameterType</tt>*
044: * <tt>visitReturnType</tt>
045: * <tt>visitExceptionType</tt>* )</li>
046: * <li><i>TypeSignature</i> = <tt>visitBaseType</tt> |
047: * <tt>visitTypeVariable</tt> | <tt>visitArrayType</tt> | (
048: * <tt>visitClassType</tt> <tt>visitTypeArgument</tt>* (
049: * <tt>visitInnerClassType</tt> <tt>visitTypeArgument</tt>* )*
050: * <tt>visitEnd</tt> ) )</li>
051: * </ul>
052: *
053: * @author Thomas Hallgren
054: * @author Eric Bruneton
055: */
056: public interface SignatureVisitor {
057:
058: /**
059: * Wildcard for an "extends" type argument.
060: */
061: char EXTENDS = '+';
062:
063: /**
064: * Wildcard for a "super" type argument.
065: */
066: char SUPER = '-';
067:
068: /**
069: * Wildcard for a normal type argument.
070: */
071: char INSTANCEOF = '=';
072:
073: /**
074: * Visits a formal type parameter.
075: *
076: * @param name
077: * the name of the formal parameter.
078: */
079: void visitFormalTypeParameter(String name);
080:
081: /**
082: * Visits the class bound of the last visited formal type parameter.
083: *
084: * @return a non null visitor to visit the signature of the class bound.
085: */
086: SignatureVisitor visitClassBound();
087:
088: /**
089: * Visits an interface bound of the last visited formal type parameter.
090: *
091: * @return a non null visitor to visit the signature of the interface bound.
092: */
093: SignatureVisitor visitInterfaceBound();
094:
095: /**
096: * Visits the type of the super class.
097: *
098: * @return a non null visitor to visit the signature of the super class
099: * type.
100: */
101: SignatureVisitor visitSuperclass();
102:
103: /**
104: * Visits the type of an interface implemented by the class.
105: *
106: * @return a non null visitor to visit the signature of the interface type.
107: */
108: SignatureVisitor visitInterface();
109:
110: /**
111: * Visits the type of a method parameter.
112: *
113: * @return a non null visitor to visit the signature of the parameter type.
114: */
115: SignatureVisitor visitParameterType();
116:
117: /**
118: * Visits the return type of the method.
119: *
120: * @return a non null visitor to visit the signature of the return type.
121: */
122: SignatureVisitor visitReturnType();
123:
124: /**
125: * Visits the type of a method exception.
126: *
127: * @return a non null visitor to visit the signature of the exception type.
128: */
129: SignatureVisitor visitExceptionType();
130:
131: /**
132: * Visits a signature corresponding to a primitive type.
133: *
134: * @param descriptor
135: * the descriptor of the primitive type, or 'V' for <tt>void</tt>.
136: */
137: void visitBaseType(char descriptor);
138:
139: /**
140: * Visits a signature corresponding to a type variable.
141: *
142: * @param name
143: * the name of the type variable.
144: */
145: void visitTypeVariable(String name);
146:
147: /**
148: * Visits a signature corresponding to an array type.
149: *
150: * @return a non null visitor to visit the signature of the array element
151: * type.
152: */
153: SignatureVisitor visitArrayType();
154:
155: /**
156: * Starts the visit of a signature corresponding to a class or interface
157: * type.
158: *
159: * @param name
160: * the internal name of the class or interface.
161: */
162: void visitClassType(String name);
163:
164: /**
165: * Visits an inner class.
166: *
167: * @param name
168: * the local name of the inner class in its enclosing class.
169: */
170: void visitInnerClassType(String name);
171:
172: /**
173: * Visits an unbounded type argument of the last visited class or inner
174: * class type.
175: */
176: void visitTypeArgument();
177:
178: /**
179: * Visits a type argument of the last visited class or inner class type.
180: *
181: * @param wildcard
182: * '+', '-' or '='.
183: * @return a non null visitor to visit the signature of the type argument.
184: */
185: SignatureVisitor visitTypeArgument(char wildcard);
186:
187: /**
188: * Ends the visit of a signature corresponding to a class or interface type.
189: */
190: void visitEnd();
191: }
|