private void setMethodValue(final Object object, final String methodName, final String value, final Optional<String> splitter, final Optional<Double> minValue, final Optional<Double> maxValue, final Optional<Double> increase)
{
try
{
final Optional<Method> method = Optional.ofNullable(methodMap.get(methodName));
if (method.isPresent())
{
final boolean isAccessible = method.get().isAccessible();
method.get().setAccessible(true);
final Class<?> typeClazz = method.get().getParameterTypes()[0];
if (typeClazz.isArray())
{
final Class<?> componentType = typeClazz.getComponentType();
final String[] arr = value.split(splitter.get());
final Object array = Array.newInstance(componentType, arr.length);
IntStream.range(0, arr.length).forEach(i -> {
final Optional<?> optional = toConverter(method.get().getName(), componentType, arr[i], Optional.empty(), Optional.empty(), Optional.empty());
if (optional.isPresent())
{
Array.set(array, i, optional.get());
}
});
method.get().invoke(object, array);
}
else
{
final Optional<?> optional = toConverter(method.get().getName(), typeClazz, value, minValue, maxValue, increase);
if (optional.isPresent())
{
method.get().invoke(object, optional.get());
}
}
method.get().setAccessible(isAccessible);
}
else
{
LOGGER.error("method parameter type length error : method name - : " + methodName);
}
}
catch (final InvocationTargetException | IllegalAccessException e)
{
e.printStackTrace();
}
}