< prev index next >

src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java

Print this page




 101         return e.accept(this, p);
 102     }
 103 
 104     /**
 105      * Visits any program element as if by passing itself to that
 106      * element's {@link Element#accept accept} method and passing
 107      * {@code null} for the additional parameter.  The invocation
 108      * {@code v.visit(elem)} is equivalent to {@code elem.accept(v,
 109      * null)}.
 110      *
 111      * @param e  the element to visit
 112      * @return a visitor-specified result
 113      */
 114     public final R visit(Element e) {
 115         return e.accept(this, null);
 116     }
 117 
 118     /**
 119      * {@inheritDoc}
 120      *
 121      * <p> The default implementation of this method in
 122      * {@code AbstractElementVisitor6} will always throw
 123      * {@code UnknownElementException}.
 124      * This behavior is not required of a subclass.
 125      *
 126      * @param e  the element to visit
 127      * @param p  a visitor-specified parameter
 128      * @return a visitor-specified result
 129      * @throws UnknownElementException
 130      *          a visitor implementation may optionally throw this exception
 131      */

 132     public R visitUnknown(Element e, P p) {
 133         throw new UnknownElementException(e, p);
 134     }
 135 
 136     /**
 137      * Visits a {@code ModuleElement} by calling {@code


 138      * visitUnknown}.
 139 
 140      * @param e  {@inheritDoc}
 141      * @param p  {@inheritDoc}
 142      * @return the result of {@code visitUnknown}
 143      *
 144      * @since 9
 145      */
 146     @Override
 147     public R visitModule(ModuleElement e, P p) {
 148         return visitUnknown(e, p);
 149     }
 150 }


 101         return e.accept(this, p);
 102     }
 103 
 104     /**
 105      * Visits any program element as if by passing itself to that
 106      * element's {@link Element#accept accept} method and passing
 107      * {@code null} for the additional parameter.  The invocation
 108      * {@code v.visit(elem)} is equivalent to {@code elem.accept(v,
 109      * null)}.
 110      *
 111      * @param e  the element to visit
 112      * @return a visitor-specified result
 113      */
 114     public final R visit(Element e) {
 115         return e.accept(this, null);
 116     }
 117 
 118     /**
 119      * {@inheritDoc}
 120      *
 121      * @implSpec The default implementation of this method in
 122      * {@code AbstractElementVisitor6} will always throw
 123      * {@code UnknownElementException}.
 124      * This behavior is not required of a subclass.
 125      *
 126      * @param e {@inheritDoc}
 127      * @param p {@inheritDoc}
 128      * @return a visitor-specified result
 129      * @throws UnknownElementException
 130      *          a visitor implementation may optionally throw this exception
 131      */
 132     @Override
 133     public R visitUnknown(Element e, P p) {
 134         throw new UnknownElementException(e, p);
 135     }
 136 
 137     /**
 138      * {@inheritDoc}
 139      *
 140      * @implSpec Visits a {@code ModuleElement} by calling {@code
 141      * visitUnknown}.
 142      *
 143      * @param e  {@inheritDoc}
 144      * @param p  {@inheritDoc}
 145      * @return the result of {@code visitUnknown}
 146      *
 147      * @since 9
 148      */
 149     @Override
 150     public R visitModule(ModuleElement e, P p) {
 151         return visitUnknown(e, p);
 152     }
 153 }
< prev index next >