Class Methods


  • public final class Methods
    extends Object
    Utility class for working with Method's
    • Constructor Detail

      • Methods

        public Methods()
    • Method Detail

      • findMatchingMethod

        public static Optional<Method> findMatchingMethod​(Set<Method> methods,
                                                          String methodName,
                                                          Class<?> returnType,
                                                          Class<?>... parametersTypes)
        Find a matching method based on:
        Parameters:
        methods - the set of method to search (e.g. fetched using methods(Class))
        methodName - the name of the method we're looking for
        returnType - the method return type that much match
        parametersTypes - the method parameter types that must be matched
        Returns:
        Optional with the exact matching method or Optional.empty()
      • methods

        public static Set<Method> methods​(Class<?> type)
        Get all methods on type. For overridden methods only the most specific (typically being the method overridden by a subclass) is returned
        Parameters:
        type - the type we want to find all methods within
        Returns:
        the list of all methods (each marked as accessible) on this type
        See Also:
        Accessibles.accessible(T)