public static void applyProperty(Object configuration, String key, String stringValue) { Class<?> configurationClass = configuration.getClass(); Method setter = ReflectUtil.getSingleSetter(key, configurationClass); if(setter != null) { try { Class<?> parameterClass = setter.getParameterTypes()[0]; Object value = PropertyHelper.convertToClass(stringValue, parameterClass); setter.invoke(configuration, value); } catch (Exception e) { throw LOG.cannotSetValueForProperty(key, configurationClass.getCanonicalName(), e); } } else { throw LOG.cannotFindSetterForProperty(key, configurationClass.getCanonicalName()); } }
public static void applyProperty(Object configuration, String key, String stringValue) { Class<?> configurationClass = configuration.getClass(); Method setter = ReflectUtil.getSingleSetter(key, configurationClass); if(setter != null) { try { Class<?> parameterClass = setter.getParameterTypes()[0]; Object value = PropertyHelper.convertToClass(stringValue, parameterClass); setter.invoke(configuration, value); } catch (Exception e) { throw LOG.cannotSetValueForProperty(key, configurationClass.getCanonicalName(), e); } } else { throw LOG.cannotFindSetterForProperty(key, configurationClass.getCanonicalName()); } }
protected void configureCache(Cache cache, String property, Object value) { Method setter; try { setter = ReflectUtil.getSingleSetter(property, cache.getClass()); } catch (ProcessEngineException e) { throw new HalRelationCacheConfigurationException("Unable to find setter for property " + property, e); } if (setter == null) { throw new HalRelationCacheConfigurationException("Unable to find setter for property " + property); } try { setter.invoke(cache, value); } catch (IllegalAccessException e) { throw new HalRelationCacheConfigurationException("Unable to access setter for property " + property); } catch (InvocationTargetException e) { throw new HalRelationCacheConfigurationException("Unable to invoke setter for property " + property); } }
protected void configureCache(Cache cache, String property, Object value) { Method setter; try { setter = ReflectUtil.getSingleSetter(property, cache.getClass()); } catch (ProcessEngineException e) { throw new HalRelationCacheConfigurationException("Unable to find setter for property " + property, e); } if (setter == null) { throw new HalRelationCacheConfigurationException("Unable to find setter for property " + property); } try { setter.invoke(cache, value); } catch (IllegalAccessException e) { throw new HalRelationCacheConfigurationException("Unable to access setter for property " + property); } catch (InvocationTargetException e) { throw new HalRelationCacheConfigurationException("Unable to invoke setter for property " + property); } }
public static void applyProperty(Object configuration, String key, String stringValue) { Class<?> configurationClass = configuration.getClass(); Method setter = ReflectUtil.getSingleSetter(key, configurationClass); if(setter != null) { try { Class<?> parameterClass = setter.getParameterTypes()[0]; Object value = PropertyHelper.convertToClass(stringValue, parameterClass); setter.invoke(configuration, value); } catch (Exception e) { throw LOG.cannotSetValueForProperty(key, configurationClass.getCanonicalName(), e); } } else { throw LOG.cannotFindSetterForProperty(key, configurationClass.getCanonicalName()); } }
protected void configureCache(Cache cache, String property, Object value) { Method setter; try { setter = ReflectUtil.getSingleSetter(property, cache.getClass()); } catch (ProcessEngineException e) { throw new HalRelationCacheConfigurationException("Unable to find setter for property " + property, e); } if (setter == null) { throw new HalRelationCacheConfigurationException("Unable to find setter for property " + property); } try { setter.invoke(cache, value); } catch (IllegalAccessException e) { throw new HalRelationCacheConfigurationException("Unable to access setter for property " + property); } catch (InvocationTargetException e) { throw new HalRelationCacheConfigurationException("Unable to invoke setter for property " + property); } }