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

org.johnnei.enjin.internal.AnnotationUtils Maven / Gradle / Ivy

The newest version!
package org.johnnei.enjin.internal;

import org.johnnei.enjin.EnjinException;
import org.johnnei.enjin.spec.EnjinMethod;

public class AnnotationUtils {

	public static EnjinMethod getMethod(Class clazz, String method, Class... parameters) {
			try {
				EnjinMethod enjinMethod = clazz.getMethod(method, parameters).getAnnotation(EnjinMethod.class);
				if (enjinMethod == null) {
					throw new EnjinException("Missing Method metadata");
				}

				return enjinMethod;
			} catch (NoSuchMethodException | SecurityException e) {
				throw new EnjinException(String.format(
					"Failed to retrieve Method value for %s#%s(%s)",
					clazz.getName(),
					method,
					parameters), e);
			}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy