Example usage for org.apache.commons.lang.mutable Mutable setValue

List of usage examples for org.apache.commons.lang.mutable Mutable setValue

Introduction

In this page you can find the example usage for org.apache.commons.lang.mutable Mutable setValue.

Prototype

void setValue(Object value);

Source Link

Document

Sets the value of this mutable.

Usage

From source file:com.ms.commons.test.common.ReflectUtil.java

public static Object invokeMethodByMemoryRow(Object object, Method method, MemoryRow memoryRow,
        Mutable outParameters) {
    Class<?>[] parameterTypes = method.getParameterTypes();
    method.getTypeParameters();/*from  w  w  w  . jav a 2 s  .c o m*/
    Object[] parameterObjects = new Object[parameterTypes.length];
    for (int i = 0; i < parameterTypes.length; i++) {
        Class<?> clazz = parameterTypes[i];
        MemoryField field = memoryRow.getField(i + 1);
        Object value = (field.getType() == MemoryFieldType.Null) ? null : field.getValue();
        parameterObjects[i] = TypeConvertUtil.convert(clazz, value);
    }
    if (outParameters != null) {
        outParameters.setValue(Arrays.asList(parameterObjects));
    }
    try {
        method.setAccessible(true);
        return method.invoke(object, parameterObjects);
    } catch (Exception e) {
        throw ExceptionUtil.wrapToRuntimeException(e);
    }
}