All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mowedgrass.jasyptgradleboot.password.ChainPasswordProvider Maven / Gradle / Ivy

There is a newer version: 0.1.32
Show 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();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy