Interface MemberUtils

  • All Superinterfaces:
    Utils

    public interface MemberUtils
    extends Utils
    The utilities class for the members in the package "javax.lang.model.", such as "field", "method", "constructor"
    Since:
    1.0.0
    Author:
    Mercy
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <T extends javax.lang.model.element.Element>
      java.util.List<T>
      findAllDeclaredMembers​(javax.lang.model.element.TypeElement type, java.util.function.Predicate<? super T>... memberFilters)
      Returns all declared members (including those from superclasses and interfaces) of the provided TypeElement, optionally filtered by one or more predicates.
      static <T extends javax.lang.model.element.Element>
      java.util.List<T>
      findAllDeclaredMembers​(javax.lang.model.type.TypeMirror type, java.util.function.Predicate<? super T>... memberFilters)
      Returns all declared members (including those from superclasses and interfaces) of the provided TypeMirror, optionally filtered by one or more predicates.
      static <T extends javax.lang.model.element.Element>
      java.util.List<T>
      findDeclaredMembers​(javax.lang.model.element.TypeElement type, boolean all, java.util.function.Predicate<? super T>... memberFilters)
      Returns the declared members of the provided TypeElement, optionally including members from superclasses and interfaces, and filtered by one or more predicates.
      static <T extends javax.lang.model.element.Element>
      java.util.List<T>
      findDeclaredMembers​(javax.lang.model.element.TypeElement type, java.util.function.Predicate<? super T>... memberFilters)
      Returns the directly declared members of the provided TypeElement, optionally filtered by one or more predicates.
      static <T extends javax.lang.model.element.Element>
      java.util.List<T>
      findDeclaredMembers​(javax.lang.model.type.TypeMirror type, boolean includeHierarchicalTypes, java.util.function.Predicate<? super T>... memberFilters)
      Returns the declared members of the provided TypeMirror, optionally including members from superclasses and interfaces, and filtered by one or more predicates.
      static <T extends javax.lang.model.element.Element>
      java.util.List<T>
      findDeclaredMembers​(javax.lang.model.type.TypeMirror type, java.util.function.Predicate<? super T>... memberFilters)
      Returns the declared members of the provided TypeMirror that match the given filters.
      static java.util.List<? extends javax.lang.model.element.Element> getAllDeclaredMembers​(javax.lang.model.element.TypeElement type)
      Returns all declared members (including those from superclasses and interfaces) of the provided TypeElement.
      static java.util.List<? extends javax.lang.model.element.Element> getAllDeclaredMembers​(javax.lang.model.type.TypeMirror type)
      Returns all declared members (including those from superclasses and interfaces) of the provided TypeMirror.
      static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.element.TypeElement type)
      Returns the directly declared members of the provided TypeElement.
      static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.element.TypeElement type, boolean includeHierarchicalTypes)
      Returns the declared members of the provided TypeElement, optionally including members from superclasses and interfaces.
      static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.type.TypeMirror type)
      Returns the directly declared members of the provided TypeMirror.
      static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.type.TypeMirror type, boolean includeHierarchicalTypes)
      Returns the declared members of the provided TypeMirror, optionally including hierarchical types.
    • Method Detail

      • getDeclaredMembers

        static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.type.TypeMirror type)
        Returns the directly declared members of the provided TypeMirror. If the given type is null, an empty list will be returned.
        Parameters:
        type - the type mirror to retrieve declared members from
        Returns:
        a list of directly declared members, or an empty list if the type is null
      • getDeclaredMembers

        static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.element.TypeElement type)
        Returns the directly declared members of the provided TypeElement. If the given type is null, an empty list will be returned.
        Parameters:
        type - the type element to retrieve declared members from
        Returns:
        a list of directly declared members, or an empty list if the type is null
      • getAllDeclaredMembers

        static java.util.List<? extends javax.lang.model.element.Element> getAllDeclaredMembers​(javax.lang.model.type.TypeMirror type)
        Returns all declared members (including those from superclasses and interfaces) of the provided TypeMirror. If the given type is null, an empty list will be returned.
        Parameters:
        type - the type mirror to retrieve all declared members from
        Returns:
        a list of all declared members, or an empty list if the type is null
      • getAllDeclaredMembers

        static java.util.List<? extends javax.lang.model.element.Element> getAllDeclaredMembers​(javax.lang.model.element.TypeElement type)
        Returns all declared members (including those from superclasses and interfaces) of the provided TypeElement. If the given type is null, an empty list will be returned.
        Parameters:
        type - the type element to retrieve all declared members from
        Returns:
        a list of all declared members, or an empty list if the type is null
      • getDeclaredMembers

        static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.type.TypeMirror type,
                                                                                             boolean includeHierarchicalTypes)
        Returns the declared members of the provided TypeMirror, optionally including hierarchical types. If the given type is null, an empty list will be returned.
        Parameters:
        type - the type mirror to retrieve declared members from
        includeHierarchicalTypes - whether to include members from superclasses and interfaces
        Returns:
        a list of declared members, or an empty list if the type is null
      • getDeclaredMembers

        static java.util.List<? extends javax.lang.model.element.Element> getDeclaredMembers​(javax.lang.model.element.TypeElement type,
                                                                                             boolean includeHierarchicalTypes)
        Returns the declared members of the provided TypeElement, optionally including members from superclasses and interfaces.

        If the given type is null, an empty list will be returned.

        Parameters:
        type - the type element to retrieve declared members from
        includeHierarchicalTypes - whether to include members from superclasses and interfaces
        Returns:
        a list of declared members, or an empty list if the type is null
      • findDeclaredMembers

        static <T extends javax.lang.model.element.Element> java.util.List<T> findDeclaredMembers​(javax.lang.model.type.TypeMirror type,
                                                                                                  java.util.function.Predicate<? super T>... memberFilters)
        Returns the declared members of the provided TypeMirror that match the given filters. If the given type is null, an empty list will be returned.
        Type Parameters:
        T - the type of elements to filter
        Parameters:
        type - the type mirror to retrieve declared members from
        memberFilters - the predicates used to filter members
        Returns:
        a list of declared members matching the filters, or an empty list if the type is null
      • findDeclaredMembers

        static <T extends javax.lang.model.element.Element> java.util.List<T> findDeclaredMembers​(javax.lang.model.element.TypeElement type,
                                                                                                  java.util.function.Predicate<? super T>... memberFilters)
        Returns the directly declared members of the provided TypeElement, optionally filtered by one or more predicates.

        If the given type is null, an empty list will be returned.

        Type Parameters:
        T - the type of elements to filter
        Parameters:
        type - the type element to retrieve declared members from
        memberFilters - the predicates used to filter members
        Returns:
        a list of declared members matching the filters, or an empty list if the type is null
      • findAllDeclaredMembers

        static <T extends javax.lang.model.element.Element> java.util.List<T> findAllDeclaredMembers​(javax.lang.model.type.TypeMirror type,
                                                                                                     java.util.function.Predicate<? super T>... memberFilters)
        Returns all declared members (including those from superclasses and interfaces) of the provided TypeMirror, optionally filtered by one or more predicates.

        If the given type is null, an empty list will be returned.

        Type Parameters:
        T - the type of elements to filter
        Parameters:
        type - the type mirror to retrieve all declared members from
        memberFilters - the predicates used to filter members
        Returns:
        a list of all declared members matching the filters, or an empty list if the type is null
      • findAllDeclaredMembers

        static <T extends javax.lang.model.element.Element> java.util.List<T> findAllDeclaredMembers​(javax.lang.model.element.TypeElement type,
                                                                                                     java.util.function.Predicate<? super T>... memberFilters)
        Returns all declared members (including those from superclasses and interfaces) of the provided TypeElement, optionally filtered by one or more predicates.

        If the given type is null, an empty list will be returned.

        Type Parameters:
        T - the type of elements to filter
        Parameters:
        type - the type element to retrieve all declared members from
        memberFilters - the predicates used to filter members
        Returns:
        a list of all declared members matching the filters, or an empty list if the type is null
      • findDeclaredMembers

        static <T extends javax.lang.model.element.Element> java.util.List<T> findDeclaredMembers​(javax.lang.model.type.TypeMirror type,
                                                                                                  boolean includeHierarchicalTypes,
                                                                                                  java.util.function.Predicate<? super T>... memberFilters)
        Returns the declared members of the provided TypeMirror, optionally including members from superclasses and interfaces, and filtered by one or more predicates.

        If the given type is null, an empty list will be returned.

        Type Parameters:
        T - the type of elements to filter
        Parameters:
        type - the type mirror to retrieve declared members from
        includeHierarchicalTypes - whether to include members from superclasses and interfaces
        memberFilters - the predicates used to filter members
        Returns:
        a list of declared members matching the filters, or an empty list if the type is null
      • findDeclaredMembers

        static <T extends javax.lang.model.element.Element> java.util.List<T> findDeclaredMembers​(javax.lang.model.element.TypeElement type,
                                                                                                  boolean all,
                                                                                                  java.util.function.Predicate<? super T>... memberFilters)
        Returns the declared members of the provided TypeElement, optionally including members from superclasses and interfaces, and filtered by one or more predicates.

        If the given type is null, an empty list will be returned.

        Type Parameters:
        T - the type of elements to filter
        Parameters:
        type - the type element to retrieve declared members from
        all - whether to include members from superclasses and interfaces
        memberFilters - the predicates used to filter members
        Returns:
        a list of declared members matching the filters, or an empty list if the type is null