/** * Return whether this {@code PropertySource} contains a property with the given name. * <p>This implementation checks for the presence of the given name within * the {@link #getPropertyNames()} array. * @param name the property to find */ public boolean containsProperty(String name) { Assert.notNull(name, "property name must not be null"); for (String candidate : this.getPropertyNames()) { if (candidate.equals(name)) { if (logger.isDebugEnabled()) { logger.debug(String.format("PropertySource [%s] contains '%s'", getName(), name)); } return true; } } if (logger.isTraceEnabled()) { logger.trace(String.format("PropertySource [%s] does not contain '%s'", getName(), name)); } return false; }
public EncryptableEnumerablePropertySourceWrapper(EnumerablePropertySource<T> delegate, EncryptablePropertyResolver resolver, EncryptablePropertyFilter filter) { super(delegate.getName(), delegate.getSource()); encryptableDelegate = new CachingDelegateEncryptablePropertySource<>(delegate, resolver, filter); }
/** * Wrap the module options property source so that it can be the only one living in the environment. This will * delegate to the parent environment ONLY IF the key is not a known module option name. */ private PropertySource<?> wrap(final EnumerablePropertySource<?> moduleOptionsPropertySource) { return new PropertySource<Object>(moduleOptionsPropertySource.getName(), moduleOptionsPropertySource) { @Override public Object getProperty(String name) { // Resolve thru the module first Object result = moduleOptionsPropertySource.getProperty(name); if (result != null) { return result; } // If module could not resolve, but it is *known* to be // a valid module option name, do NOT delegate to the env // as it could end up in false positives if (moduleOptionsPropertySource.containsProperty(name)) { return null; } else { return parent == null ? null : parent.getProperty(name); } } }; }
public EncryptableEnumerablePropertySourceWrapper(EnumerablePropertySource<T> delegate, EncryptablePropertyResolver resolver, EncryptablePropertyFilter filter) { super(delegate.getName(), delegate.getSource()); encryptableDelegate = new CachingDelegateEncryptablePropertySource<>(delegate, resolver, filter); }
final ConfigurationVo vo = new ConfigurationVo(); vo.setName(v); vo.setSource(eSource.getName()); updateVo(String.valueOf(eSource.getProperty(v)), vo); return vo;