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

br.com.caelum.brutauth.reflection.MethodInvokers Maven / Gradle / Ivy

There is a newer version: 4.0.4
Show newest version
package br.com.caelum.brutauth.reflection;

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

import br.com.caelum.brutauth.auth.rules.BrutauthRule;

/**
 * Knows how to invoke every kind of BrutauthRules
 * @author Leonardo Wolter
 *
 */
public class MethodInvokers {

	private Instance invokers;

	@Inject
	public MethodInvokers(Instance invokers) {
		this.invokers = invokers;
	}
	
	public boolean invoke(BrutauthRule brutauthRule, Argument[] arguments) {
		for (MethodInvoker methodInvoker : invokers) {
			if(methodInvoker.canInvoke(brutauthRule.getClass()))
				return methodInvoker.invoke(brutauthRule, arguments);
		}
		return false;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy