Package br.com.caelum.brutauth.reflection.methodsearchers

Source Code of br.com.caelum.brutauth.reflection.methodsearchers.MethodSearchers

package br.com.caelum.brutauth.reflection.methodsearchers;

import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;

import br.com.caelum.brutauth.auth.rules.CustomBrutauthRule;
import br.com.caelum.brutauth.reflection.BrutauthMethod;

public class MethodSearchers {

  @Inject @Any private Instance<MethodSearcher> searchers;

  public BrutauthMethod search(CustomBrutauthRule ruleToSearch, Object...withArgs){
    for (MethodSearcher searcher : searchers) {
      BrutauthMethod brutauthMethod = searcher.search(ruleToSearch, withArgs);
      if(brutauthMethod != null) return brutauthMethod;
    }
    throw new IllegalStateException("Não achei nenhum metodo para invocar na rule "+ruleToSearch.getClass().getSimpleName());
  }
}
TOP

Related Classes of br.com.caelum.brutauth.reflection.methodsearchers.MethodSearchers

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.