src/share/classes/javax/lang/model/util/ElementKindVisitor6.java

Print this page


   1 /*
   2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 182     public R visitTypeAsEnum(TypeElement e, P p) {
 183         return defaultAction(e, p);
 184     }
 185 
 186     /**
 187      * Visits an {@code INTERFACE} type element by calling {@code
 188      * defaultAction}.
 189      *.
 190      * @param e the element to visit
 191      * @param p a visitor-specified parameter
 192      * @return  the result of {@code defaultAction}
 193      */
 194     public R visitTypeAsInterface(TypeElement e, P p) {
 195         return defaultAction(e, p);
 196     }
 197 
 198     /**
 199      * Visits a variable element, dispatching to the visit method for
 200      * the specific {@linkplain ElementKind kind} of variable, {@code
 201      * ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD},
 202      * {@code LOCAL_VARIABLE}, or {@code PARAMETER}.

 203      * @param e {@inheritDoc}
 204      * @param p {@inheritDoc}
 205      * @return  the result of the kind-specific visit method
 206      */
 207     @Override
 208     public R visitVariable(VariableElement e, P p) {
 209         ElementKind k = e.getKind();
 210         switch(k) {
 211         case ENUM_CONSTANT:
 212             return visitVariableAsEnumConstant(e, p);
 213 
 214         case EXCEPTION_PARAMETER:
 215             return visitVariableAsExceptionParameter(e, p);
 216 
 217         case FIELD:
 218             return visitVariableAsField(e, p);
 219 
 220         case LOCAL_VARIABLE:
 221             return visitVariableAsLocalVariable(e, p);
 222 
 223         case PARAMETER:
 224             return visitVariableAsParameter(e, p);
 225 



 226         default:
 227             throw new AssertionError("Bad kind " + k + " for VariableElement" + e);
 228         }
 229 
 230     }
 231 
 232     /**
 233      * Visits an {@code ENUM_CONSTANT} variable element by calling
 234      * {@code defaultAction}.
 235      *
 236      * @param e the element to visit
 237      * @param p a visitor-specified parameter
 238      * @return  the result of {@code defaultAction}
 239      */
 240     public R visitVariableAsEnumConstant(VariableElement e, P p) {
 241         return defaultAction(e, p);
 242     }
 243 
 244     /**
 245      * Visits an {@code EXCEPTION_PARAMETER} variable element by calling
 246      * {@code defaultAction}.
 247      *
 248      * @param e the element to visit
 249      * @param p a visitor-specified parameter


 273      * @param p a visitor-specified parameter
 274      * @return  the result of {@code defaultAction}
 275      */
 276     public R visitVariableAsLocalVariable(VariableElement e, P p) {
 277         return defaultAction(e, p);
 278     }
 279 
 280     /**
 281      * Visits a {@code PARAMETER} variable element by calling
 282      * {@code defaultAction}.
 283      *
 284      * @param e the element to visit
 285      * @param p a visitor-specified parameter
 286      * @return  the result of {@code defaultAction}
 287      */
 288     public R visitVariableAsParameter(VariableElement e, P p) {
 289         return defaultAction(e, p);
 290     }
 291 
 292     /**














 293      * Visits an executable element, dispatching to the visit method
 294      * for the specific {@linkplain ElementKind kind} of executable,
 295      * {@code CONSTRUCTOR}, {@code INSTANCE_INIT}, {@code METHOD}, or
 296      * {@code STATIC_INIT}.
 297      *
 298      * @param e {@inheritDoc}
 299      * @param p {@inheritDoc}
 300      * @return  the result of the kind-specific visit method
 301      */
 302     @Override
 303     public R visitExecutable(ExecutableElement e, P p) {
 304         ElementKind k = e.getKind();
 305         switch(k) {
 306         case CONSTRUCTOR:
 307             return visitExecutableAsConstructor(e, p);
 308 
 309         case INSTANCE_INIT:
 310             return visitExecutableAsInstanceInit(e, p);
 311 
 312         case METHOD:


   1 /*
   2  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 182     public R visitTypeAsEnum(TypeElement e, P p) {
 183         return defaultAction(e, p);
 184     }
 185 
 186     /**
 187      * Visits an {@code INTERFACE} type element by calling {@code
 188      * defaultAction}.
 189      *.
 190      * @param e the element to visit
 191      * @param p a visitor-specified parameter
 192      * @return  the result of {@code defaultAction}
 193      */
 194     public R visitTypeAsInterface(TypeElement e, P p) {
 195         return defaultAction(e, p);
 196     }
 197 
 198     /**
 199      * Visits a variable element, dispatching to the visit method for
 200      * the specific {@linkplain ElementKind kind} of variable, {@code
 201      * ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD},
 202      * {@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}.
 203      *
 204      * @param e {@inheritDoc}
 205      * @param p {@inheritDoc}
 206      * @return  the result of the kind-specific visit method
 207      */
 208     @Override
 209     public R visitVariable(VariableElement e, P p) {
 210         ElementKind k = e.getKind();
 211         switch(k) {
 212         case ENUM_CONSTANT:
 213             return visitVariableAsEnumConstant(e, p);
 214 
 215         case EXCEPTION_PARAMETER:
 216             return visitVariableAsExceptionParameter(e, p);
 217 
 218         case FIELD:
 219             return visitVariableAsField(e, p);
 220 
 221         case LOCAL_VARIABLE:
 222             return visitVariableAsLocalVariable(e, p);
 223 
 224         case PARAMETER:
 225             return visitVariableAsParameter(e, p);
 226 
 227         case RESOURCE_VARIABLE:
 228             return visitVariableAsResourceVariable(e, p);
 229 
 230         default:
 231             throw new AssertionError("Bad kind " + k + " for VariableElement" + e);
 232         }

 233     }
 234 
 235     /**
 236      * Visits an {@code ENUM_CONSTANT} variable element by calling
 237      * {@code defaultAction}.
 238      *
 239      * @param e the element to visit
 240      * @param p a visitor-specified parameter
 241      * @return  the result of {@code defaultAction}
 242      */
 243     public R visitVariableAsEnumConstant(VariableElement e, P p) {
 244         return defaultAction(e, p);
 245     }
 246 
 247     /**
 248      * Visits an {@code EXCEPTION_PARAMETER} variable element by calling
 249      * {@code defaultAction}.
 250      *
 251      * @param e the element to visit
 252      * @param p a visitor-specified parameter


 276      * @param p a visitor-specified parameter
 277      * @return  the result of {@code defaultAction}
 278      */
 279     public R visitVariableAsLocalVariable(VariableElement e, P p) {
 280         return defaultAction(e, p);
 281     }
 282 
 283     /**
 284      * Visits a {@code PARAMETER} variable element by calling
 285      * {@code defaultAction}.
 286      *
 287      * @param e the element to visit
 288      * @param p a visitor-specified parameter
 289      * @return  the result of {@code defaultAction}
 290      */
 291     public R visitVariableAsParameter(VariableElement e, P p) {
 292         return defaultAction(e, p);
 293     }
 294 
 295     /**
 296      * Visits a {@code RESOURCE_VARIABLE} variable element by calling
 297      * {@code visitUnknown}.
 298      *
 299      * @param e the element to visit
 300      * @param p a visitor-specified parameter
 301      * @return  the result of {@code visitUnknown}
 302      *
 303      * @since 1.7
 304      */
 305     public R visitVariableAsResourceVariable(VariableElement e, P p) {
 306         return visitUnknown(e, p);
 307     }
 308 
 309     /**
 310      * Visits an executable element, dispatching to the visit method
 311      * for the specific {@linkplain ElementKind kind} of executable,
 312      * {@code CONSTRUCTOR}, {@code INSTANCE_INIT}, {@code METHOD}, or
 313      * {@code STATIC_INIT}.
 314      *
 315      * @param e {@inheritDoc}
 316      * @param p {@inheritDoc}
 317      * @return  the result of the kind-specific visit method
 318      */
 319     @Override
 320     public R visitExecutable(ExecutableElement e, P p) {
 321         ElementKind k = e.getKind();
 322         switch(k) {
 323         case CONSTRUCTOR:
 324             return visitExecutableAsConstructor(e, p);
 325 
 326         case INSTANCE_INIT:
 327             return visitExecutableAsInstanceInit(e, p);
 328 
 329         case METHOD: