public class ElementUtils extends Object
| Constructor and Description |
|---|
ElementUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkElementKind(Element elem,
ElementKind... acceptedKinds) |
static <E extends Element> |
elementsByName(Iterable<? extends E> elements)
Retrieves a by-name mapping for all the elements contained in the argument.
|
static <E extends Element> |
elementsByUniqueName(Iterable<? extends E> elements)
Retrieves a by-name mapping for all the elements contained in the argument.
|
static <E extends Element> |
filterPackageVisible(Iterable<? extends E> elemList) |
static <E extends Element> |
filterPublic(Iterable<? extends E> elemList) |
static <E extends Element> |
filterVisible(Iterable<? extends E> elemList,
Visibility minimumVisibility) |
Visibility |
getEffectiveVisibility(Element element) |
static PackageElement |
getPackage(Element elem)
Retrieves the
PackageElement for the package which (indirectly) encloses the specified element. |
static String |
getPackageName(Element elem)
Retrieves the name of the package which (indirectly) encloses the specified element.
|
public static PackageElement getPackage(Element elem)
PackageElement for the package which (indirectly) encloses the specified element.elem - the elementpublic static String getPackageName(Element elem)
elem - the elementpublic static <E extends Element> Map<String,List<E>> elementsByName(Iterable<? extends E> elements)
Note: the values of the returned map are actually Lists, since
multiple elements might have the same simple name (e.g., in case of overloaded
methods).
elements - the elementspublic static <E extends Element> Map<String,E> elementsByUniqueName(Iterable<? extends E> elements) throws DuplicateNameException
Note: unlike the above elementsByName(Iterable), the mapping does
not contain multiple elements per name. However, elements contains
multiple elements with the same simple name, a DuplicateNameException
is thrown.
elements - the elementsDuplicateNameException - if at least two elements in elements have the same
simple name.public static boolean checkElementKind(Element elem, ElementKind... acceptedKinds)
public static <E extends Element> List<E> filterVisible(Iterable<? extends E> elemList, Visibility minimumVisibility)
public static <E extends Element> List<E> filterPackageVisible(Iterable<? extends E> elemList)
public Visibility getEffectiveVisibility(Element element)
Copyright © 2013–2014. All rights reserved.