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

net.cassite.pure.ioc.handlers.ParamAnnotationHandler Maven / Gradle / Ivy

The newest version!
package net.cassite.pure.ioc.handlers;

import java.lang.annotation.Annotation;

import net.cassite.pure.ioc.AnnotationHandlingException;
import net.cassite.pure.ioc.Scope;
import net.cassite.style.reflect.MemberSup;

/**
 * retrieve an instance of given class
 *
 * @author wkgcass
 */
public interface ParamAnnotationHandler {
        /**
         * one of given annotations can be handled
         *
         * @param annotations a summary of annotations
         * @return true if one of the annos can be handled, false otherwise.
         */
        boolean canHandle(Annotation[] annotations);

        /**
         * retrieve an instance of given cls
         *
         * @param scope         wire scope
         * @param caller        the member calling for arguments
         * @param cls           class of instance to retrieve
         * @param expectedClass the class originally expected
         * @param toHandle      annotations
         * @param chain         the Param Chain
* Usually call * chain.next().handle(caller, cls, toHandle, chain) * before do real handling.
* The next() handler may throw * IrrelevantAnnotationHandlingException, it * means the next() handler failed * retrieving instance, and need current handler do * handling. * @return retrieved object to fill the param * @throws AnnotationHandlingException IrrelevantAnnotationHandlingException is thrown when it fails to retrieve object for the parameter */ Object handle(Scope scope, MemberSup caller, Class cls, Class expectedClass, Annotation[] toHandle, ParamHandlerChain chain) throws AnnotationHandlingException; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy