Package org.eclipse.jdt.core.dom
Interface IPackageBinding
- All Superinterfaces:
IBinding
A package binding represents a named or unnamed package.
- Since:
- 2.0
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Fields inherited from interface org.eclipse.jdt.core.dom.IBinding
ANNOTATION, MEMBER_VALUE_PAIR, METHOD, MODULE, PACKAGE, TYPE, VARIABLE -
Method Summary
Modifier and TypeMethodDescriptionfindTypeBinding(String name) Finds and returns the binding for the class or interface with the given name declared in this package.default IModuleBindingReturns the binding of the module associated with this package binding.getName()Returns the name of the package represented by this binding.String[]Returns the list of name component making up the name of the package represented by this binding.booleanReturns whether this package is an unnamed package.Methods inherited from interface org.eclipse.jdt.core.dom.IBinding
equals, getAnnotations, getJavaElement, getKey, getKind, getModifiers, isDeprecated, isEqualTo, isRecovered, isSynthetic, toString
-
Method Details
-
getName
String getName()Returns the name of the package represented by this binding. For named packages, this is the fully qualified package name (using "." for separators). For unnamed packages, this is an empty string. -
isUnnamed
boolean isUnnamed()Returns whether this package is an unnamed package. See The Java Language Specification section 7.4.2 for details.- Returns:
trueif this is an unnamed package, andfalseotherwise
-
getNameComponents
String[] getNameComponents()Returns the list of name component making up the name of the package represented by this binding. For example, for the package named "com.example.tool", this method returns {"com", "example", "tool"}. Returns the empty list for unnamed packages.- Returns:
- the name of the package represented by this binding, or the empty list for unnamed packages
-
getModule
Returns the binding of the module associated with this package binding.- Returns:
- the binding of the module associated with this package, or
nullif none - Since:
- 3.14
-
findTypeBinding
Finds and returns the binding for the class or interface with the given name declared in this package.For top-level classes and interfaces, the name is just the simple name of the class or interface. For member classes and interfaces, the name is prefixed by its outer class(es) with a dot separator. For example, for the following class:
the first inner class is referenced via:public class Outer { public static class Inner { public static class Inner2 {} } }"Outer.Inner"and it's inner class can be accessed via"Outer.Inner.Inner2".- Parameters:
name- the name of a class or interface- Returns:
- the type binding for the class or interface with the
given name declared in this package, or
nullif no such valid type can be found - Since:
- 3.44
-