com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableEnumerablePropertySourceWrapper Maven / Gradle / Ivy
package com.ulisesbocchio.jasyptspringboot.wrapper;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyResolver;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.util.Assert;
/**
* @author Ulises Bocchio
*/
public class EncryptableEnumerablePropertySourceWrapper extends EnumerablePropertySource implements EncryptablePropertySource {
private final EnumerablePropertySource delegate;
private final EncryptablePropertyResolver resolver;
public EncryptableEnumerablePropertySourceWrapper(EnumerablePropertySource delegate, EncryptablePropertyResolver resolver) {
super(delegate.getName(), delegate.getSource());
Assert.notNull(delegate, "PropertySource delegate cannot be null");
Assert.notNull(resolver, "EncryptablePropertyResolver cannot be null");
this.delegate = delegate;
this.resolver = resolver;
}
@Override
public Object getProperty(String name) {
return getProperty(resolver, delegate, name);
}
@Override
public String[] getPropertyNames() {
return delegate.getPropertyNames();
}
@Override
public PropertySource getDelegate() {
return delegate;
}
}