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 java.util.List;

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

@Component
public class MethodSearchers {
  private final List<MethodSearcher> searchers;

  public MethodSearchers(List<MethodSearcher> searchers) {
    this.searchers = 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.