io.quarkus.runtime.annotations.ConfigItem Maven / Gradle / Ivy
package io.quarkus.runtime.annotations;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.Optional;
/**
* A single container configuration item.
*/
@Retention(RUNTIME)
@Target({ FIELD, PARAMETER })
@Documented
public @interface ConfigItem {
/**
* Constant value for {@link #name} indicating that the annotated element's name should be used as-is.
*/
String ELEMENT_NAME = "<>";
/**
* Constant value for {@link #name()} indicating that the annotated element's name should be de-camel-cased and
* hyphenated, and then used.
*/
String HYPHENATED_ELEMENT_NAME = "<>";
/**
* Constant value for {@link #name()} indicating that the parent's name for the member referencing this item's
* group should be used as the name of this item. This value is only valid for members of configuration groups.
*/
String PARENT = "<>";
/**
* Constant value for {@link #defaultValue()} indicating that no default value should be used (the value is
* a configuration group or it is {@link Optional}).
*/
String NO_DEFAULT = "<>";
/**
* Specify the relative name of the configuration item.
*
* @return the name
*/
String name() default HYPHENATED_ELEMENT_NAME;
/**
* Specify the default value of the configuration item, if none is found in the configuration.
*
* @return the default value
*/
String defaultValue() default NO_DEFAULT;
/**
* Specify the default value documentation, when it cannot be expressed by {@link #defaultValue()}. For example,
* if your default only exists for the DEV mode, you can use {@code "true (DEV)"}.
*
* @return the default value documentation
*/
String defaultValueDocumentation() default "";
/**
* Specify whether documentation should be generated for this config item.
*
* This is only useful in very niche use cases where the build-time and runtime config
* both contain a configuration property with the exact same name,
* and we only want to generate documentation from one of them.
*
* @return whether documentation should be generated
*/
boolean generateDocumentation() default true;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy