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

org.unlaxer.tinyexpression.Invokable Maven / Gradle / Ivy

There is a newer version: 1.4.4
Show newest version
package org.unlaxer.tinyexpression;

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

public class Invokable{
	
	final Method method;
	final INSTANCE instance;
	
	public Invokable(Method method, INSTANCE instance) {
		super();
		this.method = method;
		this.instance = instance;
	}
	public Method method() {
		return method;
	}
	
	public INSTANCE instance() {
		return instance;
	}
	
	@SuppressWarnings("unchecked")
	public RETURNING invoke(Object... parameters) {
		try {
			return (RETURNING) method().invoke(instance(), parameters);
		} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
			throw new RuntimeException(e);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy