com.github.mowedgrass.jasyptgradleboot.password.ChainPasswordProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasypt-gradle-boot-encryptor Show documentation
Show all versions of jasypt-gradle-boot-encryptor Show documentation
Shared jasypt encryptor for jasypt-gradle-boot-plugin
The newest version!
package com.github.mowedgrass.jasyptgradleboot.password;
import java.util.List;
import java.util.Optional;
public abstract class ChainPasswordProvider implements PasswordProvider {
public static final String EMPTY_PASSWORD = "";
@Override
public final String getPassword() {
return filter(getCandidates());
}
protected final String filter(List> candidates) {
return candidates.stream()
.filter(Optional::isPresent)
.map(Optional::get)
.findFirst().orElse(EMPTY_PASSWORD);
}
abstract protected List> getCandidates();
}