com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableEnumerablePropertySourceWrapper Maven / Gradle / Ivy
The newest version!
package com.ulisesbocchio.jasyptspringboot.wrapper;
import com.ulisesbocchio.jasyptspringboot.caching.CachingDelegateEncryptablePropertySource;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyFilter;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyResolver;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.PropertySource;
/**
* EncryptableEnumerablePropertySourceWrapper class.
*
* @author Ulises Bocchio
* @version $Id: $Id
*/
public class EncryptableEnumerablePropertySourceWrapper extends EnumerablePropertySource implements EncryptablePropertySource {
private final CachingDelegateEncryptablePropertySource encryptableDelegate;
/**
* Constructor for EncryptableEnumerablePropertySourceWrapper.
*
* @param delegate a {@link org.springframework.core.env.EnumerablePropertySource} object
* @param resolver a {@link com.ulisesbocchio.jasyptspringboot.EncryptablePropertyResolver} object
* @param filter a {@link com.ulisesbocchio.jasyptspringboot.EncryptablePropertyFilter} object
*/
public EncryptableEnumerablePropertySourceWrapper(EnumerablePropertySource delegate, EncryptablePropertyResolver resolver, EncryptablePropertyFilter filter) {
super(delegate.getName(), delegate.getSource());
encryptableDelegate = new CachingDelegateEncryptablePropertySource<>(delegate, resolver, filter);
}
/** {@inheritDoc} */
@Override
public Object getProperty(String name) {
return encryptableDelegate.getProperty(name);
}
/** {@inheritDoc} */
@Override
public PropertySource getDelegate() {
return encryptableDelegate;
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public String[] getPropertyNames() {
return ((EnumerablePropertySource) encryptableDelegate.getDelegate()).getPropertyNames();
}
}