/*
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.reflection;

import net.ranides.assira.reflection.impl.FMethod;
import net.ranides.assira.reflection.impl.SMethod;

import java.lang.reflect.Method;

/**
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 */
public interface IMethod extends IExecutable {
    
    /**
     * Factory: creates IMethod from java.reflection method
     *
     * @param method method
     * @return IMethod
     */
    static IMethod typeinfo(Method method) {
        return FMethod.newMethod(method);
    }

    static IMethod typeinfo(StackTraceElement frame) {
        return FMethod.newMethod(frame);
    }

    /**
     * Factory: creates symbolic method with provided name and signature
     *
     * Please note, that symbolic can't be invoked and are not reflective
     *
     * @param name name
     * @param args args
     * @param rets rets
     * @return IMethod
     */
    static IMethod symbolic(String name, IArguments args, IClass<?> rets) {
        return new SMethod(name, args, rets);
    }

    @Override
    IMethods collect();

    @Override
    IMethod accessible();

    /**
     * Returns reflective Method assocciated with this IMethod.
     * Some methods are not reflective and will throw IReflectiveException
     *
     * @return Method
     */
    Method reflective();

    boolean isGetter();

    boolean isSetter();

}
