135 /** 136 * Processes an element by calling {@code e.accept(this, p)}; 137 * this method may be overridden by subclasses. 138 * @return the result of visiting {@code e}. 139 */ 140 public R scan(Element e, P p) { 141 return e.accept(this, p); 142 } 143 144 /** 145 * Convenience method equivalent to {@code v.scan(e, null)}. 146 * @return the result of scanning {@code e}. 147 */ 148 public final R scan(Element e) { 149 return scan(e, null); 150 } 151 152 /** 153 * {@inheritDoc} This implementation scans the enclosed elements. 154 * 155 * @param e the element to visit 156 * @param p a visitor-specified parameter 157 * @return the result of scanning 158 */ 159 public R visitPackage(PackageElement e, P p) { 160 return scan(e.getEnclosedElements(), p); 161 } 162 163 /** 164 * {@inheritDoc} This implementation scans the enclosed elements. 165 * 166 * @param e the element to visit 167 * @param p a visitor-specified parameter 168 * @return the result of scanning 169 */ 170 public R visitType(TypeElement e, P p) { 171 return scan(e.getEnclosedElements(), p); 172 } 173 174 /** 175 * {@inheritDoc} This implementation scans the enclosed elements. 176 * 177 * @param e the element to visit 178 * @param p a visitor-specified parameter 179 * @return the result of scanning 180 */ 181 public R visitVariable(VariableElement e, P p) { 182 return scan(e.getEnclosedElements(), p); 183 } 184 185 /** 186 * {@inheritDoc} This implementation scans the parameters. 187 * 188 * @param e the element to visit 189 * @param p a visitor-specified parameter 190 * @return the result of scanning 191 */ 192 public R visitExecutable(ExecutableElement e, P p) { 193 return scan(e.getParameters(), p); 194 } 195 196 /** 197 * {@inheritDoc} This implementation scans the enclosed elements. 198 * 199 * @param e the element to visit 200 * @param p a visitor-specified parameter 201 * @return the result of scanning 202 */ 203 public R visitTypeParameter(TypeParameterElement e, P p) { 204 return scan(e.getEnclosedElements(), p); 205 } 206 } | 135 /** 136 * Processes an element by calling {@code e.accept(this, p)}; 137 * this method may be overridden by subclasses. 138 * @return the result of visiting {@code e}. 139 */ 140 public R scan(Element e, P p) { 141 return e.accept(this, p); 142 } 143 144 /** 145 * Convenience method equivalent to {@code v.scan(e, null)}. 146 * @return the result of scanning {@code e}. 147 */ 148 public final R scan(Element e) { 149 return scan(e, null); 150 } 151 152 /** 153 * {@inheritDoc} This implementation scans the enclosed elements. 154 * 155 * @param e {@inheritDoc} 156 * @param p {@inheritDoc} 157 * @return the result of scanning 158 */ 159 public R visitPackage(PackageElement e, P p) { 160 return scan(e.getEnclosedElements(), p); 161 } 162 163 /** 164 * {@inheritDoc} This implementation scans the enclosed elements. 165 * 166 * @param e {@inheritDoc} 167 * @param p {@inheritDoc} 168 * @return the result of scanning 169 */ 170 public R visitType(TypeElement e, P p) { 171 return scan(e.getEnclosedElements(), p); 172 } 173 174 /** 175 * {@inheritDoc} 176 * 177 * This implementation scans the enclosed elements, unless the 178 * element is a {@code RESOURCE_VARIABLE} in which case {@code 179 * visitUnknown} is called. 180 * 181 * @param e {@inheritDoc} 182 * @param p {@inheritDoc} 183 * @return the result of scanning 184 */ 185 public R visitVariable(VariableElement e, P p) { 186 if (e.getKind() != ElementKind.RESOURCE_VARIABLE) 187 return scan(e.getEnclosedElements(), p); 188 else 189 return visitUnknown(e, p); 190 } 191 192 /** 193 * {@inheritDoc} This implementation scans the parameters. 194 * 195 * @param e {@inheritDoc} 196 * @param p {@inheritDoc} 197 * @return the result of scanning 198 */ 199 public R visitExecutable(ExecutableElement e, P p) { 200 return scan(e.getParameters(), p); 201 } 202 203 /** 204 * {@inheritDoc} This implementation scans the enclosed elements. 205 * 206 * @param e {@inheritDoc} 207 * @param p {@inheritDoc} 208 * @return the result of scanning 209 */ 210 public R visitTypeParameter(TypeParameterElement e, P p) { 211 return scan(e.getEnclosedElements(), p); 212 } 213 } |