private Object getInjectedValue(AttributeMetadata attribute, ConfigurationMetadata.InjectionPointMetaData injectionPoint, String prefix) throws InvalidConfigurationException { // Get the property value String name = prefix + injectionPoint.getProperty(); String value = properties.get(name); String printableValue = value; if (attribute.isSecuritySensitive()) { printableValue = "[REDACTED]"; } if (value == null) { return null; } // coerce the property value to the final type Class<?> propertyType = injectionPoint.getSetter().getParameterTypes()[0]; Object finalValue = coerce(propertyType, value); if (finalValue == null) { throw new InvalidConfigurationException(format("Could not coerce value '%s' to %s (property '%s') in order to call [%s]", printableValue, propertyType.getName(), name, injectionPoint.getSetter().toGenericString())); } usedProperties.add(name); return finalValue; }
private Object getInjectedValue(AttributeMetadata attribute, ConfigurationMetadata.InjectionPointMetaData injectionPoint, String prefix) throws InvalidConfigurationException { // Get the property value String name = prefix + injectionPoint.getProperty(); String value = properties.get(name); String printableValue = value; if (attribute.isSecuritySensitive()) { printableValue = "[REDACTED]"; } if (value == null) { return null; } // coerce the property value to the final type Class<?> propertyType = injectionPoint.getSetter().getParameterTypes()[0]; Object finalValue = coerce(propertyType, value); if (finalValue == null) { throw new InvalidConfigurationException(format("Could not coerce value '%s' to %s (property '%s') in order to call [%s]", printableValue, propertyType.getName(), name, injectionPoint.getSetter().toGenericString())); } usedProperties.add(name); return finalValue; }
private void verifyMetaData(ConfigurationMetadata<?> metadata, Class<?> configClass, String description, boolean securitySensitive, Map<String, Set<String>> attributeProperties) throws Exception { assertEquals(metadata.getConfigClass(), configClass); if (metadata.getConstructor() != null) { assertEquals(metadata.getConstructor(), configClass.getDeclaredConstructor()); } else { try { configClass.getDeclaredConstructor(); fail(String.format("Expected configClass [%s] not to have a constructor", configClass.getName())); } catch (NoSuchMethodException expected) { } } assertEquals(metadata.getAttributes().size(), attributeProperties.keySet().size()); for (String name : attributeProperties.keySet()) { AttributeMetadata attribute = metadata.getAttributes().get(name); assertEquals(attribute.getConfigClass(), configClass); Set<String> namesToTest = new HashSet<>(); namesToTest.add(attribute.getInjectionPoint().getProperty()); for (ConfigurationMetadata.InjectionPointMetaData legacyInjectionPoint : attribute.getLegacyInjectionPoints()) { namesToTest.add(legacyInjectionPoint.getProperty()); } assertEquals(namesToTest, attributeProperties.get(name)); assertEquals(attribute.getDescription(), description); assertEquals(attribute.isSecuritySensitive(), securitySensitive); } }
if (attribute.isSecuritySensitive()) { printableOperativeValue = "[REDACTED]"; String value = properties.get(fullName); String printableValue = value; if (attribute.isSecuritySensitive()) { printableValue = "[REDACTED]";
if (attribute.isSecuritySensitive()) { printableOperativeValue = "[REDACTED]"; String value = properties.get(fullName); String printableValue = value; if (attribute.isSecuritySensitive()) { printableValue = "[REDACTED]";
builder.add(new ConfigAttribute(attribute.getName(), propertyName, defaultValue, currentValue, description, attribute.isSecuritySensitive()));
builder.add(new ConfigAttribute(attribute.getName(), propertyName, defaultValue, currentValue, description, attribute.isSecuritySensitive()));
private void verifyMetaData(ConfigurationMetadata<?> metadata, Class<?> configClass, String description, boolean securitySensitive, Map<String, Set<String>> attributeProperties) throws Exception { assertEquals(metadata.getConfigClass(), configClass); if (metadata.getConstructor() != null) { assertEquals(metadata.getConstructor(), configClass.getDeclaredConstructor()); } else { try { configClass.getDeclaredConstructor(); fail(String.format("Expected configClass [%s] not to have a constructor", configClass.getName())); } catch (NoSuchMethodException expected) { } } assertEquals(metadata.getAttributes().size(), attributeProperties.keySet().size()); for (String name : attributeProperties.keySet()) { AttributeMetadata attribute = metadata.getAttributes().get(name); assertEquals(attribute.getConfigClass(), configClass); Set<String> namesToTest = new HashSet<>(); namesToTest.add(attribute.getInjectionPoint().getProperty()); for (ConfigurationMetadata.InjectionPointMetaData legacyInjectionPoint : attribute.getLegacyInjectionPoints()) { namesToTest.add(legacyInjectionPoint.getProperty()); } assertEquals(namesToTest, attributeProperties.get(name)); assertEquals(attribute.getDescription(), description); assertEquals(attribute.isSecuritySensitive(), securitySensitive); } }