Example usage for com.badlogic.gdx.utils.reflect Method getParameterTypes

List of usage examples for com.badlogic.gdx.utils.reflect Method getParameterTypes

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils.reflect Method getParameterTypes.

Prototype

public Class[] getParameterTypes() 

Source Link

Document

Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method.

Usage

From source file:com.github.ykrasik.jaci.util.reflection.ReflectionUtils.java

License:Apache License

/**
 * Assert that the given method takes no parameters.
 *
 * @param method Method to assert.//  w  w  w.ja  v  a2  s  .  c o  m
 * @throws IllegalArgumentException If the method takes any parameters.
 */
public static void assertNoParameters(Method method) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes.length > 0) {
        final String message = ("Class=\'" + method.getDeclaringClass() + "\', method=\'" + method.getName()
                + "\': Must take no parameters!");
        throw new IllegalArgumentException(message);
    }
}

From source file:com.github.ykrasik.jaci.util.reflection.ReflectionUtils.java

License:Apache License

/**
 * Returns basic information about a method's parameters obtained via reflection.
 *
 * @param method Method to reflect parameters for.
 * @return The method's parameter information obtained via reflection.
 *///w ww.j a  v a2 s . c o m
public static List<ReflectionParameter> reflectMethodParameters(Method method) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    final Annotation[][] parameterAnnotations = new Annotation[0][0];//method.getParameterAnnotations(); TODO:NEED THIS METHOD IN LIBGDX
    final List<ReflectionParameter> params = new ArrayList<>(parameterTypes.length);
    if (parameterTypes == null)
        return params;

    for (int i = 0; i < parameterTypes.length; i++) {
        final Class<?> parameterType = parameterTypes[i];
        final Annotation[] annotations = parameterAnnotations[i];
        params.add(new ReflectionParameter(parameterType, annotations, i));
    }
    return params;
}