1 | /******************************************************************************* |
---|---|
2 | * Copyright (c) 2000, 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 | package org.eclipse.jdt.core.dom; |
16 | |
17 | /** |
18 | * A package binding represents a named or unnamed package. |
19 | * |
20 | * @since 2.0 |
21 | * @noimplement This interface is not intended to be implemented by clients. |
22 | */ |
23 | public interface IPackageBinding extends IBinding { |
24 | |
25 | /** |
26 | * Returns the name of the package represented by this binding. For named |
27 | * packages, this is the fully qualified package name (using "." for |
28 | * separators). For unnamed packages, this is an empty string. |
29 | * |
30 | * @return the name of the package represented by this binding, or |
31 | * an empty string for an unnamed package |
32 | */ |
33 | @Override |
34 | public String getName(); |
35 | |
36 | /** |
37 | * Returns whether this package is an unnamed package. |
38 | * See <em>The Java Language Specification</em> section 7.4.2 for details. |
39 | * |
40 | * @return <code>true</code> if this is an unnamed package, and |
41 | * <code>false</code> otherwise |
42 | */ |
43 | public boolean isUnnamed(); |
44 | |
45 | /** |
46 | * Returns the list of name component making up the name of the package |
47 | * represented by this binding. For example, for the package named |
48 | * "com.example.tool", this method returns {"com", "example", "tool"}. |
49 | * Returns the empty list for unnamed packages. |
50 | * |
51 | * @return the name of the package represented by this binding, or the |
52 | * empty list for unnamed packages |
53 | */ |
54 | public String[] getNameComponents(); |
55 | |
56 | /** |
57 | * Returns the binding of the module associated with this package binding. |
58 | * @return the binding of the module associated with this package, or |
59 | * <code>null</code> if none |
60 | * |
61 | * @since 3.14 |
62 | */ |
63 | public default IModuleBinding getModule() { |
64 | return null; |
65 | } |
66 | // /** |
67 | // * Finds and returns the binding for the class or interface with the given |
68 | // * name declared in this package. |
69 | // * <p> |
70 | // * For top-level classes and interfaces, the name here is just the simple |
71 | // * name of the class or interface. For nested classes and interfaces, the |
72 | // * name is the VM class name (in other words, a name like |
73 | // * <code>"Outer$Inner"</code> as used to name the class file; see |
74 | // * <code>ITypeBinding.getName</code>). |
75 | // * </p> |
76 | // * |
77 | // * @param name the name of a class or interface |
78 | // * @return the type binding for the class or interface with the |
79 | // * given name declared in this package, or <code>null</code> |
80 | // * if there is no such type |
81 | // */ |
82 | // public ITypeBinding findTypeBinding(String name); |
83 | } |
84 |
Members