public class ElementFilter extends Object
Filters for selecting just the elements of interest from a collection of elements. The returned sets and lists are new collections and do use the argument as a backing store. The methods in this class do not make any attempts to guard against concurrent modifications of the arguments. The returned sets and lists are mutable but unsafe for concurrent access. A returned set has the same iteration order as the argument set to a method.
If iterables and sets containing null
are passed as arguments to methods in this class, a NullPointerException
will be thrown.
Note that a static import statement can make the text of calls to the methods in this class more concise; for example:
import static javax.lang.model.util.ElementFilter.*; ... List<VariableElement> fs = fieldsIn(someClass.getEnclosedElements());
public static List<VariableElement> fieldsIn(Iterable<? extends Element> elements)
Returns a list of fields in elements
.
elements
- the elements to filterelements
public static Set<VariableElement> fieldsIn(Set<? extends Element> elements)
Returns a set of fields in elements
.
elements
- the elements to filterelements
public static List<ExecutableElement> constructorsIn(Iterable<? extends Element> elements)
Returns a list of constructors in elements
.
elements
- the elements to filterelements
public static Set<ExecutableElement> constructorsIn(Set<? extends Element> elements)
Returns a set of constructors in elements
.
elements
- the elements to filterelements
public static List<ExecutableElement> methodsIn(Iterable<? extends Element> elements)
Returns a list of methods in elements
.
elements
- the elements to filterelements
public static Set<ExecutableElement> methodsIn(Set<? extends Element> elements)
Returns a set of methods in elements
.
elements
- the elements to filterelements
public static List<TypeElement> typesIn(Iterable<? extends Element> elements)
Returns a list of types in elements
.
elements
- the elements to filterelements
public static Set<TypeElement> typesIn(Set<? extends Element> elements)
Returns a set of types in elements
.
elements
- the elements to filterelements
public static List<PackageElement> packagesIn(Iterable<? extends Element> elements)
Returns a list of packages in elements
.
elements
- the elements to filterelements
public static Set<PackageElement> packagesIn(Set<? extends Element> elements)
Returns a set of packages in elements
.
elements
- the elements to filterelements
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.