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; |
12 | |
13 | import org.eclipse.pde.api.tools.internal.provisional.descriptors.IElementDescriptor; |
14 | |
15 | /** |
16 | * A visitor for an API component. Component visitors must subclass |
17 | * this class. |
18 | * <p> |
19 | * Package nodes are visited, followed by its type nodes. Component |
20 | * specific nodes are visited before children nodes. |
21 | * </p> |
22 | * <p> |
23 | * Specific visit ordering: |
24 | * <pre> |
25 | * ComponentDescription := [visitElement[PackageDescription] endVisitElement[PackageDescription]]* |
26 | * PackageDescription := [visitElement[TypeDescription] endVisitElement[TypeDescription]]* |
27 | * TypeDescription := [[visitElement[OverrideDescription] endVisitElement[OverrideDescription]]* [visitElement[MemberDescription] endVisitElement[MemberDescription]]*]* |
28 | * MemberDescription := MethodDescription | FieldDescription |
29 | * OverrideDescription := PackageDescription | TypeDescription | MethodDescription | FieldDescription |
30 | * </pre> |
31 | * |
32 | * MemberDescriptions are visited in the order they are keyed for the backing {@link HashMap} |
33 | * </p> |
34 | * |
35 | * @since 1.0.0 |
36 | */ |
37 | public abstract class ApiDescriptionVisitor { |
38 | |
39 | /** |
40 | * Visits an element in the manifest and returns whether children nodes |
41 | * in the manifest should be visited. |
42 | * <p> |
43 | * The default implementation does nothing and returns <code>true</code>. |
44 | * Subclasses may re-implement. |
45 | * </p> |
46 | * @param element element being visited |
47 | * @param description description of the element visited |
48 | * @return whether child elements should be visited |
49 | */ |
50 | public boolean visitElement(IElementDescriptor element, IApiAnnotations description) { |
51 | return true; |
52 | } |
53 | |
54 | /** |
55 | * End visiting an element. |
56 | * <p> |
57 | * The default implementation does nothing. Subclasses may re-implement. |
58 | * </p> |
59 | * @param element element being end-visited |
60 | * @param description description of the element end-visited |
61 | */ |
62 | public void endVisitElement(IElementDescriptor element, IApiAnnotations description) { |
63 | // subclasses may re-implement |
64 | } |
65 | } |