tkalkirill commented on code in PR #2386:
URL: https://github.com/apache/ignite-3/pull/2386#discussion_r1289853153
##########
modules/configuration/README.md:
##########
@@ -195,6 +202,38 @@ public static class DatetimeColumnConfigurationSchema
extends ColumnConfiguratio
Thus, a column can only be one of these (varchar, decimal and datetime) types
and will contain the
type, name and fields specific to it.
+### Configuration extension
+
+Allows to add properties into other configurations.
Review Comment:
Probably not about adding properties, but expanding existing configurations.
##########
modules/configuration/README.md:
##########
@@ -95,6 +95,12 @@ public static class AbstractConfigurationSchema {
@Value(hasDefault = true)
public int intVal = 0;
}
+
+@ConfigurationExtension
Review Comment:
Need an example internal configuration.
##########
modules/configuration/README.md:
##########
@@ -109,6 +115,7 @@ public static class AbstractConfigurationSchema {
a unique identifier among the inheritors of one polymorphic configuration,
used to define the type (schema) of the polymorphic configuration we are
dealing with now;
* `@AbstractConfiguration` is similar to `@PolymorphicConfig` but its type
cannot be changed and its inheritors must be annotated with
either `@Config` or `@ConfigurationRoot`. Configuration schemas with this
annotation cannot be used as a nested (sub)configuration;
+* `@ConfigurationExtension` allows to mix-in properties into `@Config` or
`@ConfigurationRoot`.
Review Comment:
I don't quite understand what you wanted to say.
Probably it would be necessary to say that this is an extension and so on.
##########
modules/configuration/README.md:
##########
@@ -195,6 +202,38 @@ public static class DatetimeColumnConfigurationSchema
extends ColumnConfiguratio
Thus, a column can only be one of these (varchar, decimal and datetime) types
and will contain the
type, name and fields specific to it.
+### Configuration extension
+
+Allows to add properties into other configurations.
+
+Suppose we have a `security` module and want to add one more authentication
component that is located
+in a different module that depends on `security`.
+
+```java
+@ConfigurationRoot(rootName = "security", type = ConfigurationType.DISTRIBUTED)
+public class SecurityConfigurationSchema {
+ @ConfigValue
+ public AuthenticationConfigurationSchema authentication;
+}
+
+@Config
+public class AuthenticationConfigurationSchema {
+ @Value(hasDefault = true)
+ public final boolean enabled = false;
+}
+```
+
+What we need to do is to subclass the configuration we want to extend.
+
+```java
+@ConfigurationExtension
+public class UserSecurityConfigurationSchema extends
SecurityConfigurationSchema {
+ @Value
+ public final String user;
+}
+```
+And the resulting configuration will look as if the field `user` was declared
directly in `SecurityConfigurationSchema`.
Review Comment:
Unfortunately, nothing is said about the internal expansion of the
configuration.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]