List of usage examples for org.apache.commons.lang.reflect MethodUtils invokeMethod
public static Object invokeMethod(Object object, String methodName, Object[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
Invoke a named method whose parameter type matches the object type.
This method delegates the method search to #getMatchingAccessibleMethod(Class,String,Class[]) .
This method supports calls to methods taking primitive parameters via passing in wrapping classes.
From source file:org.nekorp.workflow.desktop.view.resource.imp.CostoServicioTableModel.java
@Override public Object getValueAt(int rowIndex, int columnIndex) { try {/*w w w. j av a 2 s . co m*/ return MethodUtils.invokeMethod(this.datos.get(rowIndex), this.metodosGet.get(columnIndex), new Object[] {}); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { throw new IllegalArgumentException("Mal configurado el modelo de la tabla costos", ex); } }
From source file:org.openhab.binding.weather.internal.utils.PropertyUtils.java
/** * Returns the getter value from the object instance, nested properties are * possible. If the propertyName is for example temperature.current, the * methods getTemperature().getCurrent() are called. *//*from w w w.ja v a 2s . c o m*/ public static Object getPropertyValue(Object instance, String property) throws Exception { Object object = getNestedObject(instance, property); String getMethod = toGetterString(PropertyResolver.last(property)); return MethodUtils.invokeMethod(object, getMethod, null); }