[OmniFaces utilities] The
isOneAnnotationPresent()
method returns true
if the given class has at least one of the given annotations.Method:
Usage:
Check if the specified class is a JSF/CDI managed bean:
import org.omnifaces.util.Utils;
import javax.inject.Named;
import javax.faces.bean.ManagedBean;
...
Class[] annotations = new Class[]{Named.class,
ManagedBean.class};
boolean
isAnyAnnotations = Utils.isOneAnnotationPresent(MyClass.class, annotations);
Check if the
specified class is a scoped/session/application CDI managed bean:
import org.omnifaces.util.Utils;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
...
Class[] annotations = new Class[]{RequestScoped.class,
SessionScoped.class, ApplicationScoped.class};
boolean
isAnyAnnotations = Utils.isOneAnnotationPresent(MyCDIBean.class, annotations);
Niciun comentariu :
Trimiteți un comentariu