Class ElementFilter


  • public class ElementFilter
    extends java.lang.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.

    Since:
    1.6
    • Method Detail

      • fieldsIn

        public static java.util.List<VariableElement> fieldsIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of fields in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of fields in elements
      • fieldsIn

        public static java.util.Set<VariableElement> fieldsIn​(java.util.Set<? extends Element> elements)
        Returns a set of fields in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of fields in elements
      • recordComponentsIn

        public static java.util.List<RecordComponentElement> recordComponentsIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of record components in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of record components in elements
        Since:
        14
      • recordComponentsIn

        public static java.util.Set<RecordComponentElement> recordComponentsIn​(java.util.Set<? extends Element> elements)
        Returns a set of record components in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of record components in elements
        Since:
        14
      • constructorsIn

        public static java.util.List<ExecutableElement> constructorsIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of constructors in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of constructors in elements
      • constructorsIn

        public static java.util.Set<ExecutableElement> constructorsIn​(java.util.Set<? extends Element> elements)
        Returns a set of constructors in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of constructors in elements
      • methodsIn

        public static java.util.List<ExecutableElement> methodsIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of methods in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of methods in elements
      • methodsIn

        public static java.util.Set<ExecutableElement> methodsIn​(java.util.Set<? extends Element> elements)
        Returns a set of methods in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of methods in elements
      • typesIn

        public static java.util.List<TypeElement> typesIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of types in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of types in elements
      • typesIn

        public static java.util.Set<TypeElement> typesIn​(java.util.Set<? extends Element> elements)
        Returns a set of types in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of types in elements
      • packagesIn

        public static java.util.List<PackageElement> packagesIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of packages in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of packages in elements
      • packagesIn

        public static java.util.Set<PackageElement> packagesIn​(java.util.Set<? extends Element> elements)
        Returns a set of packages in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of packages in elements
      • modulesIn

        public static java.util.List<ModuleElement> modulesIn​(java.lang.Iterable<? extends Element> elements)
        Returns a list of modules in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a list of modules in elements
        Since:
        9
      • modulesIn

        public static java.util.Set<ModuleElement> modulesIn​(java.util.Set<? extends Element> elements)
        Returns a set of modules in elements.
        Parameters:
        elements - the elements to filter
        Returns:
        a set of modules in elements
        Since:
        9
      • exportsIn

        public static java.util.List<ModuleElement.ExportsDirective> exportsIn​(java.lang.Iterable<? extends ModuleElement.Directive> directives)
        Returns a list of exports directives in directives.
        Parameters:
        directives - the directives to filter
        Returns:
        a list of exports directives in directives
        Since:
        9
      • opensIn

        public static java.util.List<ModuleElement.OpensDirective> opensIn​(java.lang.Iterable<? extends ModuleElement.Directive> directives)
        Returns a list of opens directives in directives.
        Parameters:
        directives - the directives to filter
        Returns:
        a list of opens directives in directives
        Since:
        9
      • providesIn

        public static java.util.List<ModuleElement.ProvidesDirective> providesIn​(java.lang.Iterable<? extends ModuleElement.Directive> directives)
        Returns a list of provides directives in directives.
        Parameters:
        directives - the directives to filter
        Returns:
        a list of provides directives in directives
        Since:
        9
      • requiresIn

        public static java.util.List<ModuleElement.RequiresDirective> requiresIn​(java.lang.Iterable<? extends ModuleElement.Directive> directives)
        Returns a list of requires directives in directives.
        Parameters:
        directives - the directives to filter
        Returns:
        a list of requires directives in directives
        Since:
        9
      • usesIn

        public static java.util.List<ModuleElement.UsesDirective> usesIn​(java.lang.Iterable<? extends ModuleElement.Directive> directives)
        Returns a list of uses directives in directives.
        Parameters:
        directives - the directives to filter
        Returns:
        a list of uses directives in directives
        Since:
        9