package net.ranides.assira.reflection;

import net.ranides.assira.functional.special.AnyFunction;

public interface BeanMethodBinding extends AnyFunction<Object> {

    String name();

    /**
     * Returns true if this method can be invoked with arguments of specified types.
     * Behaviour of invoke is identical as {@link IMethod#matches(IClasses arguments)}
     *
     * @param arguments arguments
     * @return bool
     */
    boolean matches(IClasses arguments);

    /**
     * Returns true if this method can be invoked with arguments of specified types.
     * Behaviour of invoke is identical as {@link IMethod#matches(IClasses arguments)}
     *
     * @param arguments arguments
     * @return bool
     */
    default boolean matches(IClass<?>... arguments) {
        return matches(IClasses.typeinfo(arguments));
    }

    /**
     * Returns true if this method can be invoked with arguments of specified types.
     * Behaviour of invoke is identical as {@link IMethod#matches(Class... arguments)}
     *
     * @param arguments arguments
     * @return bool
     */
    default boolean matches(Class<?>... arguments) {
        return matches(IClasses.typeinfo(arguments));
    }

    /**
     * Returns true if this method can be invoked without arguments.
     * Effectively it means that checks if method is static.
     * Behaviour of invoke is identical as {@link IMethod#matches()}
     *
     * @return bool
     */
    default boolean matches() {
        return matches(IClasses.empty());
    }

}
