Interface IPackageBinding

All Superinterfaces:
IBinding

public interface IPackageBinding extends IBinding
A package binding represents a named or unnamed package.
Since:
2.0
  • Field Summary

    Fields inherited from interface IBinding

    ANNOTATION, MEMBER_VALUE_PAIR, METHOD, MODULE, PACKAGE, TYPE, VARIABLE
    Modifier and Type
    Field
    Description
    static final int
    Kind constant (value 5) indicating an annotation binding.
    static final int
    Kind constant (value 6) indicating a member value pair binding.
    static final int
    Kind constant (value 4) indicating a method or constructor binding.
    static final int
    Kind constant (value 7) indicating a module binding (added in JLS9 API).
    static final int
    Kind constant (value 1) indicating a package binding.
    static final int
    Kind constant (value 2) indicating a type binding.
    static final int
    Kind constant (value 3) indicating a field or local variable binding.
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds and returns the binding for the class or interface with the given name declared in this package.
    Returns the binding of the module associated with this package binding.
    Returns the name of the package represented by this binding.
    Returns the list of name component making up the name of the package represented by this binding.
    boolean
    Returns whether this package is an unnamed package.

    Methods inherited from interface IBinding

    equals, getAnnotations, getJavaElement, getKey, getKind, getModifiers, isDeprecated, isEqualTo, isRecovered, isSynthetic, toString
    Modifier and Type
    Method
    Description
    boolean
    There is no special definition of equality for bindings; equality is simply object identity.
    Returns the resolved declaration annotations associated with this binding.
    Returns the Java element that corresponds to this binding.
    Returns the key for this binding.
    int
    Returns the kind of bindings this is.
    int
    Returns the modifiers for this binding.
    boolean
    Return whether this binding is for something that is deprecated.
    boolean
    Returns whether this binding has the same key as that of the given binding.
    boolean
    Return whether this binding is created because the bindings recovery is enabled.
    boolean
    Returns whether this binding is synthetic.
    Returns a string representation of this binding suitable for debugging purposes only.
  • 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.
      Specified by:
      getName in interface IBinding
      Returns:
      the name of the package represented by this binding, or an empty string for an unnamed package
    • isUnnamed

      boolean isUnnamed()
      Returns whether this package is an unnamed package. See The Java Language Specification section 7.4.2 for details.
      Returns:
      true if this is an unnamed package, and false otherwise
    • 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

      default IModuleBinding getModule()
      Returns the binding of the module associated with this package binding.
      Returns:
      the binding of the module associated with this package, or null if none
      Since:
      3.14
    • findTypeBinding

      ITypeBinding findTypeBinding(String name)
      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:

          public class Outer {
              public static class Inner {
                   public static class Inner2 {}
              }
          }
       
      the first inner class is referenced via: "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 null if no such valid type can be found
      Since:
      3.44