
net.alantea.viewml.MethodInformation Maven / Gradle / Ivy
package net.alantea.viewml;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.LinkedList;
import java.util.List;
/**
* The Class MethodInformation.
*/
public class MethodInformation
{
/** The target. */
private Object target;
/** The method. */
private Method method;
/** The types. */
private List> types;
/**
* Instantiates a new method information.
*
* @param meth the method
*/
public MethodInformation(Method meth)
{
this(null, meth);
}
/**
* Instantiates a new method information.
*
* @param object the object
* @param meth the meth
*/
public MethodInformation(Object object, Method meth)
{
target = object;
method = meth;
types = new LinkedList<>();
for (Parameter param : meth.getParameters())
{
types.add(param.getType());
}
}
/**
* Gets the types.
*
* @return the types
*/
List> getTypes()
{
return types;
}
/**
* Invoke.
*
* @param args the args
* @throws IllegalAccessException the illegal access exception
* @throws IllegalArgumentException the illegal argument exception
* @throws InvocationTargetException the invocation target exception
*/
public void invoke(Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
method.invoke(target, args);
}
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
return method.getName();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy