langtools/src/java.compiler/share/classes/javax/lang/model/util/Elements.java
changeset 42824 89b14017e8d6
parent 37848 3c8ff4204d2d
child 42825 c22877f68145
equal deleted inserted replaced
42823:58864b03c7b9 42824:89b14017e8d6
    45  * @since 1.6
    45  * @since 1.6
    46  */
    46  */
    47 public interface Elements {
    47 public interface Elements {
    48 
    48 
    49     /**
    49     /**
    50      * Returns a package given its fully qualified name.
    50      * Returns a package given its fully qualified name if the package is unique in the environment.
       
    51      * If running with modules, all modules in the modules graph are searched for matching packages.
    51      *
    52      *
    52      * @param name  fully qualified package name, or an empty string for an unnamed package
    53      * @param name  fully qualified package name, or an empty string for an unnamed package
    53      * @return the named package, or {@code null} if it cannot be found
    54      * @return the named package, or {@code null} if it cannot be uniquely found
    54      */
    55      */
    55     PackageElement getPackageElement(CharSequence name);
    56     PackageElement getPackageElement(CharSequence name);
    56 
    57 
    57     /**
    58     /**
    58      * Returns a package given its fully qualified name, as seen from the given module.
    59      * Returns a package given its fully qualified name, as seen from the given module.
    63      * @since 9
    64      * @since 9
    64      */
    65      */
    65     PackageElement getPackageElement(ModuleElement module, CharSequence name);
    66     PackageElement getPackageElement(ModuleElement module, CharSequence name);
    66 
    67 
    67     /**
    68     /**
    68      * Returns a type element given its canonical name.
    69      * Returns a type element given its canonical name if the type element is unique in the environment.
       
    70      * If running with modules, all modules in the modules graph are searched for matching
       
    71      * type elements.
    69      *
    72      *
    70      * @param name  the canonical name
    73      * @param name  the canonical name
    71      * @return the named type element, or {@code null} if it cannot be found
    74      * @return the named type element, or {@code null} if it cannot be uniquely found
    72      */
    75      */
    73     TypeElement getTypeElement(CharSequence name);
    76     TypeElement getTypeElement(CharSequence name);
    74 
    77 
    75     /**
    78     /**
    76      * Returns a type element given its canonical name, as seen from the given module.
    79      * Returns a type element given its canonical name, as seen from the given module.
    82      */
    85      */
    83     TypeElement getTypeElement(ModuleElement module, CharSequence name);
    86     TypeElement getTypeElement(ModuleElement module, CharSequence name);
    84 
    87 
    85     /**
    88     /**
    86      * Returns a module element given its fully qualified name.
    89      * Returns a module element given its fully qualified name.
       
    90      * If the named module cannot be found, null is returned. One situation where a module
       
    91      * cannot be found is if the environment does not include modules, such as
       
    92      * an annotation processing environment configured for
       
    93      * a {@linkplain ProcessingEnvironment#getSourceVersion source version} without modules.      *
    87      *
    94      *
    88      * @param name  the name
    95      * @param name  the name
    89      * @return the named module element, or {@code null} if it cannot be found
    96      * @return the named module element, or {@code null} if it cannot be found
    90      * @since 9
    97      * @since 9
    91      */
    98      */
   157     PackageElement getPackageOf(Element type);
   164     PackageElement getPackageOf(Element type);
   158 
   165 
   159     /**
   166     /**
   160      * Returns the module of an element.  The module of a module is
   167      * Returns the module of an element.  The module of a module is
   161      * itself.
   168      * itself.
       
   169      * If there is no module for the element, null is returned. One situation where there is
       
   170      * no module for an element is if the environment does not include modules, such as
       
   171      * an annotation processing environment configured for
       
   172      * a {@linkplain ProcessingEnvironment#getSourceVersion source version} without modules.      *
   162      *
   173      *
   163      * @param type the element being examined
   174      * @param type the element being examined
   164      * @return the module of an element
   175      * @return the module of an element
   165      * @since 9
   176      * @since 9
   166      */
   177      */