Open ppkarwasz opened 7 months ago
The problem seems to be in the @PluginAttribute
annotation that has plethora of defaultFoo
methods. The instance factory is not able therefore to distinguish between:
@PluginAttribute(defaulBoolean = false)
from:
@PluginAttribute
Personally I think we should reduce the complexity of the annotation to only include:
public @interface PluginAttribute {
// The default value of the attribute or {@code null} if empty.
String defaultValue() default String.EMPTY;
// If not empty, gives the name of the system property that gives the default value.
String defaultProperty() default String.EMPTY;
String value() default Strings.EMPTY;
boolean sensitive() default false;
}
Remark: trimming down the defaultFoo()
is also good for documentation purposes. Using the aforementioned defaultValue/defaultProperty
we can easily document the default value of the attribute in log4j-docgen
.
BTW: I think that we can entirely eliminate the @PluginBuilderAttribute
(replaced by @PluginAttribute
) and @PluginFactory
(replaced by @Factory
) annotations.
If a component builder has a method:
the instance factory will inject
Boolean.FALSE
instead of the expectednull
if the value is not present.