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

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

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

import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Set;

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

/**
 * Handles every kind of annotations. 
* false/null/exception would be returned/thrown in order to end the HandlingChain. * * @author wkgcass */ public class EmptyHandler implements ParamAnnotationHandler, TypeAnnotationHandler, ConstructorFilter { private static EmptyHandler inst = null; private EmptyHandler() { } public static EmptyHandler getInstance() { if (null == inst) { synchronized (EmptyHandler.class) { if (null == inst) { inst = new EmptyHandler(); } } } return inst; } @Override public boolean canHandle(Set annotations) { return true; } @Override public Object handle(Scope scope, MemberSup caller, Class cls, Class expectedClass, Annotation[] toHandle, ParamHandlerChain chain) throws AnnotationHandlingException { throw new IrrelevantAnnotationHandlingException(); } @Override public boolean canHandle(Annotation[] annotations) { return true; } @Override public Object handle(Scope scope, Class cls, Class expectedClass, TypeHandlerChain chain) throws AnnotationHandlingException { throw new IrrelevantAnnotationHandlingException(); } @Override public ConstructorSup handle(Scope scope, List> cons, ConstructorFilterChain chain) throws AnnotationHandlingException { return null; } }