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

io.quarkus.runtime.BannerRecorder Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.runtime;

import java.util.Optional;
import java.util.function.Supplier;

import io.quarkus.runtime.annotations.Recorder;

@Recorder
public class BannerRecorder {
    final RuntimeValue bannerRuntimeConfig;

    public BannerRecorder(RuntimeValue bannerRuntimeConfig) {
        this.bannerRuntimeConfig = bannerRuntimeConfig;
    }

    public RuntimeValue>> provideBannerSupplier(String bannerText) {
        if (bannerRuntimeConfig.getValue().enabled) {
            return new RuntimeValue<>(Optional.of(new ConstantSupplier(bannerText)));
        }
        return new RuntimeValue<>(Optional.empty());
    }

    private static final class ConstantSupplier implements Supplier {

        private final String value;

        public ConstantSupplier(String value) {
            this.value = value;
        }

        @Override
        public String get() {
            return value;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy