private <T> void setConfigProperty(T instance, AttributeMetadata attribute, String prefix, Problems problems) throws InvalidConfigurationException { // Get property value ConfigurationMetadata.InjectionPointMetaData injectionPoint = findOperativeInjectionPoint(attribute, prefix, problems); // If we did not get an injection point, do not call the setter if (injectionPoint == null) { return; } if (injectionPoint.getSetter().isAnnotationPresent(Deprecated.class)) { problems.addWarning("Configuration property '%s' is deprecated and should not be used", prefix + injectionPoint.getProperty()); } Object value = getInjectedValue(attribute, injectionPoint, prefix); try { injectionPoint.getSetter().invoke(instance, value); } catch (Throwable e) { if (e instanceof InvocationTargetException && e.getCause() != null) { e = e.getCause(); } throw new InvalidConfigurationException(e, format("Error invoking configuration method [%s]", injectionPoint.getSetter().toGenericString())); } }
private <T> void setConfigProperty(T instance, AttributeMetadata attribute, String prefix, Problems problems) throws InvalidConfigurationException { // Get property value ConfigurationMetadata.InjectionPointMetaData injectionPoint = findOperativeInjectionPoint(attribute, prefix, problems); // If we did not get an injection point, do not call the setter if (injectionPoint == null) { return; } if (injectionPoint.getSetter().isAnnotationPresent(Deprecated.class)) { problems.addWarning("Configuration property '%s' is deprecated and should not be used", prefix + injectionPoint.getProperty()); } Object value = getInjectedValue(attribute, injectionPoint, prefix); try { injectionPoint.getSetter().invoke(instance, value); } catch (Throwable e) { if (e instanceof InvocationTargetException && e.getCause() != null) { e = e.getCause(); } throw new InvalidConfigurationException(e, format("Error invoking configuration method [%s]", injectionPoint.getSetter().toGenericString())); } }
private <T> void setConfigProperty(T instance, AttributeMetadata attribute, String prefix, Problems problems) throws InvalidConfigurationException { // Get property value ConfigurationMetadata.InjectionPointMetaData injectionPoint = findOperativeInjectionPoint(attribute, prefix, problems); // If we did not get an injection point, do not call the setter if (injectionPoint == null) { return; } if (injectionPoint.getSetter().isAnnotationPresent(Deprecated.class)) { problems.addWarning("Configuration property '%s' is deprecated and should not be used", injectionPoint.getProperty()); } Object value = getInjectedValue(injectionPoint, prefix); try { injectionPoint.getSetter().invoke(instance, value); } catch (Throwable e) { if (e instanceof InvocationTargetException && e.getCause() != null) { e = e.getCause(); } throw new InvalidConfigurationException(e, "Error invoking configuration method [%s]", injectionPoint.getSetter().toGenericString()); } }