Package br.com.caelum.brutauth.reflection

Examples of br.com.caelum.brutauth.reflection.NamedParametersMethod


public class DefaultMethodSearcher {

  public NamedParametersMethod getMethod(CustomBrutauthRule toInvoke) throws NoSuchMethodException {
    Method[] methods = toInvoke.getClass().getMethods();
    for (Method method : methods) {
      if(isDefaultMethod(method)) return new NamedParametersMethod(method);
    }
    throw new NoSuchMethodException("Your rule should have a method with name 'isAllowed' or annotated with '@" + BrutauthValidation.class.getSimpleName() + "' and return boolean.  Rule: "+ toInvoke.getClass());
  }
View Full Code Here


  }
 
  @Override
  public BrutauthMethod search(CustomBrutauthRule ruleToSearch, Argument...arguments) {
    try {
      NamedParametersMethod defaultMethod = defaultMethodSearcher.getMethod(ruleToSearch);
      Parameter[] classes = defaultMethod.getParameters();
     
      Argument[] matchedArguments = matcher.getValuesMatchingParameters(classes, arguments);
      return new BrutauthMethod(matchedArguments, defaultMethod.getMethod(), ruleToSearch);
    } catch (NoSuchMethodException e) {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.brutauth.reflection.NamedParametersMethod

Copyright © 2018 www.massapicom. 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.