All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cmeza.spring.ioc.handler.handlers.IocMethodInterceptor Maven / Gradle / Ivy

The newest version!
package com.cmeza.spring.ioc.handler.handlers;

import com.cmeza.spring.ioc.handler.utils.IocUtil;

import java.lang.reflect.Method;
import java.util.Optional;

@SuppressWarnings("unchecked")
public interface IocMethodInterceptor {
    Optional invoke(Object proxy, IocTarget target, Method method, Object[] args);

    default Class getInterceptResultTypes() {
        return (Class) IocUtil.getGenericInterface(this);
    }

    default boolean accept(Class clazz) {
        return getInterceptResultTypes() != null && getInterceptResultTypes().isAssignableFrom(clazz);
    }
}