Search in sources :

Example 1 with MethodParameter

use of jodd.paramo.MethodParameter in project jodd by oblac.

the class DbQueryBuilder method resolveMethodParameterNames.

/**
	 * Resolves method parameter names.
	 */
protected String[] resolveMethodParameterNames(ProxyTargetInfo proxyTargetInfo) {
    String[] paramNames;
    Method method;
    try {
        method = proxyTargetInfo.targetClass.getDeclaredMethod(proxyTargetInfo.targetMethodName, proxyTargetInfo.argumentsClasses);
    } catch (NoSuchMethodException ex) {
        throw new DbOomException(ex);
    }
    MethodParameter[] methodParameters = Paramo.resolveParameters(method);
    paramNames = new String[methodParameters.length];
    for (int i = 0; i < methodParameters.length; i++) {
        MethodParameter methodParameter = methodParameters[i];
        paramNames[i] = methodParameter.getName();
    }
    return paramNames;
}
Also used : DbOomException(jodd.db.oom.DbOomException) Method(java.lang.reflect.Method) MethodParameter(jodd.paramo.MethodParameter)

Example 2 with MethodParameter

use of jodd.paramo.MethodParameter in project jodd by oblac.

the class Wimp method aaa.

public String aaa(int Welcome, String To, Object Jodd) {
    String methodName = ProxyTarget.targetMethodName();
    Class[] argTypes = ProxyTarget.createArgumentsClassArray();
    Class targetClass = ProxyTarget.targetClass();
    Method m = null;
    try {
        m = targetClass.getDeclaredMethod(methodName, argTypes);
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
    MethodParameter[] methodParameters = Paramo.resolveParameters(m);
    Class c = ProxyTarget.argumentType(1);
    Object val = ProxyTarget.argument(1);
    return c.getName() + val.toString() + methodParameters[0].getName() + methodParameters[1].getName() + methodParameters[2].getName();
}
Also used : Method(java.lang.reflect.Method) MethodParameter(jodd.paramo.MethodParameter)

Aggregations

Method (java.lang.reflect.Method)2 MethodParameter (jodd.paramo.MethodParameter)2 DbOomException (jodd.db.oom.DbOomException)1