1 | /******************************************************************************* |
2 | * Copyright (c) 2007, 2008 IBM Corporation and others. |
3 | * All rights reserved. This program and the accompanying materials |
4 | * are made available under the terms of the Eclipse Public License v1.0 |
5 | * which accompanies this distribution, and is available at |
6 | * http://www.eclipse.org/legal/epl-v10.html |
7 | * |
8 | * Contributors: |
9 | * IBM Corporation - initial API and implementation |
10 | *******************************************************************************/ |
11 | package org.eclipse.pde.api.tools.internal.provisional.model; |
12 | |
13 | import org.eclipse.core.runtime.CoreException; |
14 | |
15 | /** |
16 | * Visits {@link IApiElement}s in an {@link IApiScope} |
17 | * |
18 | * @since 1.0.0 |
19 | */ |
20 | public class ApiScopeVisitor { |
21 | /** |
22 | * End visiting an {@link IApiComponent}. |
23 | * <p> |
24 | * The default implementation does nothing. Subclasses may re-implement. |
25 | * </p> |
26 | */ |
27 | public void endVisit(IApiComponent component) throws CoreException { |
28 | // subclasses may re-implement |
29 | } |
30 | /** |
31 | * End visiting an {@link IApiBaseline}. |
32 | * <p> |
33 | * The default implementation does nothing. Subclasses may re-implement. |
34 | * </p> |
35 | */ |
36 | public void endVisit(IApiBaseline baseline) throws CoreException { |
37 | // subclasses may re-implement |
38 | } |
39 | /** |
40 | * End visiting an {@link IApiTypeContainer}. |
41 | * <p> |
42 | * The default implementation does nothing. Subclasses may re-implement. |
43 | * </p> |
44 | */ |
45 | public void endVisit(IApiTypeContainer container) throws CoreException { |
46 | // subclasses may re-implement |
47 | } |
48 | /** |
49 | * End visiting an {@link IApiTypeRoot}. |
50 | * <p> |
51 | * The default implementation does nothing. Subclasses may re-implement. |
52 | * </p> |
53 | */ |
54 | public void endVisit(IApiTypeRoot typeRoot) throws CoreException { |
55 | // subclasses may re-implement |
56 | } |
57 | /** |
58 | * Visits a component in the scope and returns whether class files |
59 | * in the component should be visited. This method is only called when |
60 | * the class file container being visited is contained in an API component. |
61 | * <p> |
62 | * The default implementation does nothing and returns <code>true</code>. |
63 | * Subclasses may re-implement. |
64 | * </p> |
65 | * @param component API component being visited |
66 | * @return whether class files in the component should be visited |
67 | * @throws CoreException if an exception occurs during the visit |
68 | */ |
69 | public boolean visit(IApiComponent component) throws CoreException { |
70 | return true; |
71 | } |
72 | /** |
73 | * Visits a baseline in the scope and returns whether components |
74 | * in the baseline should be visited. |
75 | * <p> |
76 | * The default implementation does nothing and returns <code>true</code>. |
77 | * Subclasses may re-implement. |
78 | * </p> |
79 | * @param baseline API baseline being visited |
80 | * @return whether API baseline's components should be visited |
81 | * @throws CoreException if an exception occurs during the visit |
82 | */ |
83 | public boolean visit(IApiBaseline baseline) throws CoreException { |
84 | return true; |
85 | } |
86 | /** |
87 | * Visits an API type container in the scope and returns whether types |
88 | * in the container should be visited. |
89 | * <p> |
90 | * The default implementation does nothing and returns <code>true</code>. |
91 | * Subclasses may re-implement. |
92 | * </p> |
93 | * @param container the given API type container being visited |
94 | * @return whether types in the container should be visited |
95 | * @throws CoreException if an exception occurs during the visit |
96 | */ |
97 | public boolean visit(IApiTypeContainer container) throws CoreException { |
98 | return true; |
99 | } |
100 | /** |
101 | * Visits an API type root in the scope. |
102 | * <p> |
103 | * The default implementation does nothing and returns <code>true</code>. |
104 | * Subclasses may re-implement. |
105 | * </p> |
106 | * @param typeRoot the given API type root being visited |
107 | * @return whether types in the container should be visited |
108 | * @throws CoreException if an exception occurs during the visit |
109 | */ |
110 | public void visit(IApiTypeRoot typeRoot) throws CoreException { |
111 | } |
112 | } |