001: /*
002: * @(#)TypeVisitor.java 1.4 04/06/07
003: *
004: * Copyright (c) 2004, Sun Microsystems, Inc.
005: * All rights reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions are met:
009: *
010: * * Redistributions of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: * * Redistributions in binary form must reproduce the above copyright
013: * notice, this list of conditions and the following disclaimer in the
014: * documentation and/or other materials provided with the distribution.
015: * * Neither the name of the Sun Microsystems, Inc. nor the names of
016: * its contributors may be used to endorse or promote products derived from
017: * this software without specific prior written permission.
018: *
019: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
020: * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
021: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
022: * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
023: * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
024: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
025: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
026: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
027: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
028: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
029: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030: */
031:
032: package com.sun.mirror.util;
033:
034: import com.sun.mirror.type.*;
035:
036: /**
037: * A visitor for types, in the style of the standard visitor design pattern.
038: * This is used to operate on a type when the kind
039: * of type is unknown at compile time.
040: * When a visitor is passed to a type's
041: * {@link TypeMirror#accept accept} method,
042: * the most specific <tt>visit<i>Xxx</i></tt> method applicable to
043: * that type is invoked.
044: *
045: * @author Joseph D. Darcy
046: * @author Scott Seligman
047: * @version 1.4 04/06/07
048: * @since 1.5
049: */
050:
051: public interface TypeVisitor {
052:
053: /**
054: * Visits a type mirror.
055: *
056: * @param t the type to visit
057: */
058: public void visitTypeMirror(TypeMirror t);
059:
060: /**
061: * Visits a primitive type.
062:
063: * @param t the type to visit
064: */
065: public void visitPrimitiveType(PrimitiveType t);
066:
067: /**
068: * Visits a void type.
069: *
070: * @param t the type to visit
071: */
072: public void visitVoidType(VoidType t);
073:
074: /**
075: * Visits a reference type.
076: *
077: * @param t the type to visit
078: */
079: public void visitReferenceType(ReferenceType t);
080:
081: /**
082: * Visits a declared type.
083: *
084: * @param t the type to visit
085: */
086: public void visitDeclaredType(DeclaredType t);
087:
088: /**
089: * Visits a class type.
090: *
091: * @param t the type to visit
092: */
093: public void visitClassType(ClassType t);
094:
095: /**
096: * Visits an enum type.
097: *
098: * @param t the type to visit
099: */
100: public void visitEnumType(EnumType t);
101:
102: /**
103: * Visits an interface type.
104: *
105: * @param t the type to visit
106: */
107: public void visitInterfaceType(InterfaceType t);
108:
109: /**
110: * Visits an annotation type.
111: *
112: * @param t the type to visit
113: */
114: public void visitAnnotationType(AnnotationType t);
115:
116: /**
117: * Visits an array type.
118: *
119: * @param t the type to visit
120: */
121: public void visitArrayType(ArrayType t);
122:
123: /**
124: * Visits a type variable.
125: *
126: * @param t the type to visit
127: */
128: public void visitTypeVariable(TypeVariable t);
129:
130: /**
131: * Visits a wildcard.
132: *
133: * @param t the type to visit
134: */
135: public void visitWildcardType(WildcardType t);
136: }
|