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

com.terapico.caf.SimpleInvocationTool Maven / Gradle / Ivy

package com.terapico.caf;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;

public class SimpleInvocationTool implements InvocationTool {
	
	
	protected void checkForPrimaryType(Method method, Object parameters[]){
		
		Type [] parameterTypes = method.getParameterTypes();
		for(int i=0;i< parameterTypes.length;i++){
			if(checkSingleParameter(parameterTypes[i], parameters[i])){
				continue;
			}
			//find issue here;
			String message = "The method("+method.getName()+")'s parameters["+i+"] is a primary type("+parameterTypes[i]+"), not applicable for a null input";
			throw new IllegalArgumentException(message);
		}
		
		
	}
	static Type [] primaryTypes={int.class,float.class,double.class,long.class,char.class};
	protected boolean checkSingleParameter(Type type, Object value){
		if(value!=null){
			return true;
		}
		for(int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy