| 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 | |
| 14 | /** |
| 15 | * Visits {@link IApiTypeRoot}s in an {@link IApiTypeContainer} |
| 16 | * |
| 17 | * @since 1.0.0 |
| 18 | */ |
| 19 | public abstract class ApiTypeContainerVisitor { |
| 20 | |
| 21 | /** |
| 22 | * Visits a component in the container and returns whether class files |
| 23 | * in the component should be visited. This method is only called when |
| 24 | * the class file container being visited is contained in an API component. |
| 25 | * <p> |
| 26 | * The default implementation does nothing and returns <code>true</code>. |
| 27 | * Subclasses may re-implement. |
| 28 | * </p> |
| 29 | * @param component API component being visited |
| 30 | * @return whether class files in the component should be visited |
| 31 | */ |
| 32 | public boolean visit(IApiComponent component) { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * End visiting a component. This method is only called when |
| 38 | * the class file container being visited is contained in an API component. |
| 39 | * <p> |
| 40 | * The default implementation does nothing. Subclasses may re-implement. |
| 41 | * </p> |
| 42 | * @param component API component |
| 43 | */ |
| 44 | public void end(IApiComponent component) { |
| 45 | // subclasses may re-implement |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Visits a container and returns whether class files |
| 50 | * in the container should be visited. |
| 51 | * <p> |
| 52 | * The default implementation does nothing and returns <code>true</code>. |
| 53 | * Subclasses may re-implement. |
| 54 | * </p> |
| 55 | * @param container |
| 56 | * @return |
| 57 | */ |
| 58 | public boolean visit(IApiTypeContainer container) { |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Ends visiting a container. |
| 64 | * <p> |
| 65 | * The default implementation does nothing. Subclasses may re-implement. |
| 66 | * </p> |
| 67 | * @param container |
| 68 | */ |
| 69 | public void end(IApiTypeContainer container) { |
| 70 | //subclasses my re-implement |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Visits a package in the container and returns whether class files |
| 75 | * in the package should be visited. |
| 76 | * <p> |
| 77 | * The default implementation does nothing and returns <code>true</code>. |
| 78 | * Subclasses may re-implement. |
| 79 | * </p> |
| 80 | * @param packageName fully qualified dot separated package name or the empty |
| 81 | * string for the default package |
| 82 | * @return whether class files in the package should be visited |
| 83 | */ |
| 84 | public boolean visitPackage(String packageName) { |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * End visiting a package. |
| 90 | * <p> |
| 91 | * The default implementation does nothing. Subclasses may re-implement. |
| 92 | * </p> |
| 93 | * @param packageName fully qualified dot separated package name or the empty |
| 94 | * string for the default package |
| 95 | */ |
| 96 | public void endVisitPackage(String packageName) { |
| 97 | // subclasses may re-implement |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Visits an {@link IApiTypeRoot} from the specified package. |
| 102 | * <p> |
| 103 | * The default implementation does nothing. |
| 104 | * </p> |
| 105 | * @param packageName fully qualified dot separated package name or the empty |
| 106 | * string for the default package |
| 107 | * @param typeroot {@link IApiTypeRoot} to visit |
| 108 | */ |
| 109 | public void visit(String packageName, IApiTypeRoot typeroot) { |
| 110 | // subclasses may re-implement |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * End visiting an {@link IApiTypeRoot}. |
| 115 | * <p> |
| 116 | * The default implementation does nothing. Subclasses may re-implement. |
| 117 | * </p> |
| 118 | * @param packageName fully qualified dot separated package name or the empty |
| 119 | * string for the default package |
| 120 | * @param typeroot {@link IApiTypeRoot} ending visit on |
| 121 | */ |
| 122 | public void end(String packageName, IApiTypeRoot typeroot) { |
| 123 | // subclasses may re-implement |
| 124 | } |
| 125 | } |