Class MethodFinder


  • public class MethodFinder
    extends java.lang.Object
    Static utility method for finding all methods, declared and inherited, on a type.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MethodFinder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static <E extends java.lang.Exception>
      void
      addSupertypesToSet​(javax.lang.model.element.TypeElement type, java.util.Set<javax.lang.model.element.TypeElement> mutableSet, MethodFinder.ErrorTypeHandling<E> errorTypeHandling)  
      private static <E extends java.lang.Exception>
      com.google.common.collect.ImmutableSet<javax.lang.model.element.TypeElement>
      getSupertypes​(javax.lang.model.element.TypeElement type, MethodFinder.ErrorTypeHandling<E> errorTypeHandling)  
      private static <E extends java.lang.Exception>
      java.util.Optional<javax.lang.model.element.TypeElement>
      maybeTypeElement​(javax.lang.model.type.TypeMirror mirror, MethodFinder.ErrorTypeHandling<E> errorTypeHandling)  
      static <E extends java.lang.Exception>
      com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement>
      methodsOn​(javax.lang.model.element.TypeElement type, javax.lang.model.util.Elements elements, MethodFinder.ErrorTypeHandling<E> errorTypeHandling)
      Returns all methods, declared and inherited, on type, except those specified by Object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MethodFinder

        private MethodFinder()
    • Method Detail

      • methodsOn

        public static <E extends java.lang.Exception> com.google.common.collect.ImmutableSet<javax.lang.model.element.ExecutableElement> methodsOn​(javax.lang.model.element.TypeElement type,
                                                                                                                                                   javax.lang.model.util.Elements elements,
                                                                                                                                                   MethodFinder.ErrorTypeHandling<E> errorTypeHandling)
                                                                                                                                            throws E extends java.lang.Exception
        Returns all methods, declared and inherited, on type, except those specified by Object.

        If method B overrides method A, only method B will be included in the return set. Additionally, if methods A and B have the same signature, but are on unrelated interfaces, one will be arbitrarily picked to be returned.

        Throws:
        E extends java.lang.Exception
      • getSupertypes

        private static <E extends java.lang.Exception> com.google.common.collect.ImmutableSet<javax.lang.model.element.TypeElement> getSupertypes​(javax.lang.model.element.TypeElement type,
                                                                                                                                                  MethodFinder.ErrorTypeHandling<E> errorTypeHandling)
                                                                                                                                           throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception
      • addSupertypesToSet

        private static <E extends java.lang.Exception> void addSupertypesToSet​(javax.lang.model.element.TypeElement type,
                                                                               java.util.Set<javax.lang.model.element.TypeElement> mutableSet,
                                                                               MethodFinder.ErrorTypeHandling<E> errorTypeHandling)
                                                                        throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception
      • maybeTypeElement

        private static <E extends java.lang.Exception> java.util.Optional<javax.lang.model.element.TypeElement> maybeTypeElement​(javax.lang.model.type.TypeMirror mirror,
                                                                                                                                 MethodFinder.ErrorTypeHandling<E> errorTypeHandling)
                                                                                                                          throws E extends java.lang.Exception
        Throws:
        E extends java.lang.Exception