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

br.com.caelum.brutauth.verifier.MethodArguments Maven / Gradle / Ivy

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

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import br.com.caelum.brutauth.reflection.Argument;
import br.com.caelum.vraptor.core.MethodInfo;
import br.com.caelum.vraptor.http.ValuedParameter;

public class MethodArguments {
	
	private MethodInfo info;

	@Inject
	public MethodArguments(MethodInfo info) {
		this.info = info;
	}

	public Argument[] getValuedArguments() {
		ValuedParameter[] valuedParameters = info.getValuedParameters();
		List valuedArguments = new ArrayList();
		for (int i = 0; i < valuedParameters.length; i++) {
			ValuedParameter valuedParameter = valuedParameters[i];
			boolean validParameter = valuedParameter != null && valuedParameter.getValue() != null;
			if(validParameter) {
				Argument argument = new Argument(valuedParameter.getName(), valuedParameter.getValue());
				valuedArguments.add(argument);
			}
		}
		return valuedArguments.toArray(new Argument[] {});
		
	}
	
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy