147 * 148 * @param e the element to scan 149 * @param p a scanner-specified parameter 150 * @return the result of visiting {@code e}. 151 */ 152 public R scan(Element e, P p) { 153 return e.accept(this, p); 154 } 155 156 /** 157 * Convenience method equivalent to {@code v.scan(e, null)}. 158 * 159 * @param e the element to scan 160 * @return the result of scanning {@code e}. 161 */ 162 public final R scan(Element e) { 163 return scan(e, null); 164 } 165 166 /** 167 * {@inheritDoc} This implementation scans the enclosed elements. 168 * 169 * @param e {@inheritDoc} 170 * @param p {@inheritDoc} 171 * @return the result of scanning 172 */ 173 public R visitPackage(PackageElement e, P p) { 174 return scan(e.getEnclosedElements(), p); 175 } 176 177 /** 178 * {@inheritDoc} This implementation scans the enclosed elements. 179 * 180 * @param e {@inheritDoc} 181 * @param p {@inheritDoc} 182 * @return the result of scanning 183 */ 184 public R visitType(TypeElement e, P p) { 185 return scan(e.getEnclosedElements(), p); 186 } 187 188 /** 189 * {@inheritDoc} 190 * 191 * This implementation scans the enclosed elements, unless the 192 * element is a {@code RESOURCE_VARIABLE} in which case {@code 193 * visitUnknown} is called. 194 * 195 * @param e {@inheritDoc} 196 * @param p {@inheritDoc} 197 * @return the result of scanning 198 */ 199 public R visitVariable(VariableElement e, P p) { 200 if (e.getKind() != ElementKind.RESOURCE_VARIABLE) 201 return scan(e.getEnclosedElements(), p); 202 else 203 return visitUnknown(e, p); 204 } 205 206 /** 207 * {@inheritDoc} This implementation scans the parameters. 208 * 209 * @param e {@inheritDoc} 210 * @param p {@inheritDoc} 211 * @return the result of scanning 212 */ 213 public R visitExecutable(ExecutableElement e, P p) { 214 return scan(e.getParameters(), p); 215 } 216 217 /** 218 * {@inheritDoc} This implementation scans the enclosed elements. 219 * 220 * @param e {@inheritDoc} 221 * @param p {@inheritDoc} 222 * @return the result of scanning 223 */ 224 public R visitTypeParameter(TypeParameterElement e, P p) { 225 return scan(e.getEnclosedElements(), p); 226 } 227 } | 147 * 148 * @param e the element to scan 149 * @param p a scanner-specified parameter 150 * @return the result of visiting {@code e}. 151 */ 152 public R scan(Element e, P p) { 153 return e.accept(this, p); 154 } 155 156 /** 157 * Convenience method equivalent to {@code v.scan(e, null)}. 158 * 159 * @param e the element to scan 160 * @return the result of scanning {@code e}. 161 */ 162 public final R scan(Element e) { 163 return scan(e, null); 164 } 165 166 /** 167 * {@inheritDoc} 168 * 169 * @implSpec This implementation scans the enclosed elements. 170 * 171 * @param e {@inheritDoc} 172 * @param p {@inheritDoc} 173 * @return the result of scanning 174 */ 175 public R visitPackage(PackageElement e, P p) { 176 return scan(e.getEnclosedElements(), p); 177 } 178 179 /** 180 * {@inheritDoc} 181 * 182 * @implSpec This implementation scans the enclosed elements. 183 * 184 * @param e {@inheritDoc} 185 * @param p {@inheritDoc} 186 * @return the result of scanning 187 */ 188 public R visitType(TypeElement e, P p) { 189 return scan(e.getEnclosedElements(), p); 190 } 191 192 /** 193 * {@inheritDoc} 194 * 195 * @implSpec This implementation scans the enclosed elements, unless the 196 * element is a {@code RESOURCE_VARIABLE} in which case {@code 197 * visitUnknown} is called. 198 * 199 * @param e {@inheritDoc} 200 * @param p {@inheritDoc} 201 * @return the result of scanning 202 */ 203 public R visitVariable(VariableElement e, P p) { 204 if (e.getKind() != ElementKind.RESOURCE_VARIABLE) 205 return scan(e.getEnclosedElements(), p); 206 else 207 return visitUnknown(e, p); 208 } 209 210 /** 211 * {@inheritDoc} 212 * 213 * @implSpec This implementation scans the parameters. 214 * 215 * @param e {@inheritDoc} 216 * @param p {@inheritDoc} 217 * @return the result of scanning 218 */ 219 public R visitExecutable(ExecutableElement e, P p) { 220 return scan(e.getParameters(), p); 221 } 222 223 /** 224 * {@inheritDoc} 225 * 226 * @implSpec This implementation scans the enclosed elements. 227 * 228 * @param e {@inheritDoc} 229 * @param p {@inheritDoc} 230 * @return the result of scanning 231 */ 232 public R visitTypeParameter(TypeParameterElement e, P p) { 233 return scan(e.getEnclosedElements(), p); 234 } 235 } |