Define the enable function in BindingsPropertiesProcessor

Aperta
#114 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

Start with the BindingsPropertiesProcessor interface and its process method, then find the existing implementations that check conditions inside process. Add the default enable(Environment) method from the issue and move those checks into it. Done when the interface has the default method and the implementations use it instead of their inline checks.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Define the enable function in BindingsPropertiesProcessor like this:

/**
 * An interface for types that transform the contents of a {@link Bindings} into properties for injection into a
 * {@link org.springframework.core.env.PropertySource}.
 */
@FunctionalInterface
public interface BindingsPropertiesProcessor {

    /**
     * Transform the currently accumulated {@link Bindings}-related properties.
     *
     * @param environment the {@link Environment} that the processor is executing with.
     * @param bindings    the {@code Bindings} exposed to the application.
     * @param properties  the currently accumulated properties.
     */
    void process(Environment environment, Bindings bindings, Map<String, Object> properties);
    
    /**
     * Whether it is enabled the processor.
     * @param environment the {@link Environment} that the processor is executing with.
     * @return if true the to execute process.
     */
    default boolean enable(Environment environment) {
        return true;
    }

}

Processing the verification operations coupled in the process through the enable function is more reasonable in design, and the implementation of subclasses will also be more elegant.

Lingua principale
Java
Stelle
50
Fork
33
Merge medio
6g 2h
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spring-cloud/spring-cloud-bindings

Tutte le issue di spring-cloud/spring-cloud-bindings

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.