| 1 | /******************************************************************************* |
|---|---|
| 2 | * Copyright (c) 2017 IBM Corporation and others. |
| 3 | * |
| 4 | * This program and the accompanying materials |
| 5 | * are made available under the terms of the Eclipse Public License 2.0 |
| 6 | * which accompanies this distribution, and is available at |
| 7 | * https://www.eclipse.org/legal/epl-2.0/ |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | * |
| 11 | * Contributors: |
| 12 | * IBM Corporation - initial API and implementation |
| 13 | * |
| 14 | *******************************************************************************/ |
| 15 | |
| 16 | package org.eclipse.jdt.core.dom; |
| 17 | |
| 18 | /** |
| 19 | * A module binding represents a module (added in JLS9 API). |
| 20 | * |
| 21 | * @since 3.14 |
| 22 | * @noimplement This interface is not intended to be implemented by clients. |
| 23 | */ |
| 24 | public interface IModuleBinding extends IBinding { |
| 25 | |
| 26 | @Override |
| 27 | public default int getKind() { |
| 28 | return IBinding.MODULE; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Returns whether this module is open or not. |
| 33 | * |
| 34 | * @return <code>true</code> if open, <code>false</code> otherwise |
| 35 | */ |
| 36 | public abstract boolean isOpen(); |
| 37 | |
| 38 | /** |
| 39 | * Returns all required modules. |
| 40 | * <p>The resulting bindings are in no particular order.</p> |
| 41 | * |
| 42 | * @return all required modules |
| 43 | */ |
| 44 | public abstract IModuleBinding[] getRequiredModules(); |
| 45 | |
| 46 | /** |
| 47 | * Returns all exported packages. |
| 48 | * <p>The resulting bindings are in no particular order.</p> |
| 49 | * |
| 50 | * @return array of exported package bindings |
| 51 | */ |
| 52 | public abstract IPackageBinding[] getExportedPackages(); |
| 53 | |
| 54 | /** |
| 55 | * If this module exports the given package to specific modules, returns the array of names of |
| 56 | * modules, otherwise returns an empty array. |
| 57 | * |
| 58 | * @param packageBinding a package binding for which targeted modules are declared |
| 59 | * @return array of names of targeted modules |
| 60 | */ |
| 61 | public abstract String[] getExportedTo(IPackageBinding packageBinding); |
| 62 | |
| 63 | /** |
| 64 | * Returns all opened packages. |
| 65 | * <p>The resulting bindings are in no particular order.</p> |
| 66 | * |
| 67 | * @return array of package bindings |
| 68 | */ |
| 69 | public abstract IPackageBinding[] getOpenedPackages(); |
| 70 | |
| 71 | /** |
| 72 | * If this module opens the given package to specific modules, returns the array of names of |
| 73 | * modules, otherwise returns an empty array. |
| 74 | * <p>The resulting bindings are in no particular order.</p> |
| 75 | * |
| 76 | * @param packageBinding a package binding for which targeted modules are declared |
| 77 | * @return array of names of targeted modules |
| 78 | */ |
| 79 | public abstract String[] getOpenedTo(IPackageBinding packageBinding); |
| 80 | |
| 81 | /** |
| 82 | * Returns the services used by this module. |
| 83 | * <p>The resulting bindings are in no particular order.</p> |
| 84 | * |
| 85 | * @return array of type bindings |
| 86 | */ |
| 87 | public abstract ITypeBinding[] getUses(); |
| 88 | |
| 89 | /** |
| 90 | * Returns the services provided by this module. |
| 91 | * <p>The resulting services are in no particular order.</p> |
| 92 | * |
| 93 | * @return array of services |
| 94 | */ |
| 95 | public abstract ITypeBinding[] getServices(); |
| 96 | |
| 97 | /** |
| 98 | * Returns the implementations that implement the given service in this module. |
| 99 | * |
| 100 | * @return array of implementation type bindings, in declaration order |
| 101 | */ |
| 102 | public abstract ITypeBinding[] getImplementations(ITypeBinding service); |
| 103 | } |
| 104 |
Members