tkalkirill commented on a change in pull request #499:
URL: https://github.com/apache/ignite-3/pull/499#discussion_r773177356



##########
File path: 
modules/configuration/src/main/java/org/apache/ignite/internal/configuration/DynamicProperty.java
##########
@@ -50,28 +61,40 @@
      * @param changer Configuration changer.
      * @param listenOnly Only adding listeners mode, without the ability to 
get or update the property value.
      * @param readOnly Value cannot be changed.
-     * @param injectedNameField Configuration field with {@link InjectedName}.
      */
     public DynamicProperty(
             List<String> prefix,
             String key,
             RootKey<?, ?> rootKey,
             DynamicConfigurationChanger changer,
             boolean listenOnly,
-            boolean readOnly,
-            boolean injectedNameField
+            boolean readOnly
     ) {
-        super(prefix, key, rootKey, changer, listenOnly);
+        super(
+                INJECTED_NAME.equals(key) || INTERNAL_ID.equals(key) ? prefix 
: appendKey(prefix, key),
+                key,
+                rootKey,
+                changer,
+                listenOnly
+        );
 
         this.readOnly = readOnly;
-        this.injectedNameField = injectedNameField;
+
+        this.injectedNameField = INJECTED_NAME.equals(key);
+        this.internalIdField = INTERNAL_ID.equals(key);
     }
 
     /** {@inheritDoc} */
     @Override
     public T value() {
         if (injectedNameField) {
+            // In this case "refreshValue()" is not of type "T", but an 
"InnerNode" holding it instead.

Review comment:
       If it is not used correctly, an **ClassCastException** will be thrown, 
if it makes sense to add **assert**?

##########
File path: 
modules/configuration/src/main/java/org/apache/ignite/internal/configuration/DynamicProperty.java
##########
@@ -50,28 +61,40 @@
      * @param changer Configuration changer.
      * @param listenOnly Only adding listeners mode, without the ability to 
get or update the property value.
      * @param readOnly Value cannot be changed.
-     * @param injectedNameField Configuration field with {@link InjectedName}.
      */
     public DynamicProperty(
             List<String> prefix,
             String key,
             RootKey<?, ?> rootKey,
             DynamicConfigurationChanger changer,
             boolean listenOnly,
-            boolean readOnly,
-            boolean injectedNameField
+            boolean readOnly
     ) {
-        super(prefix, key, rootKey, changer, listenOnly);
+        super(
+                INJECTED_NAME.equals(key) || INTERNAL_ID.equals(key) ? prefix 
: appendKey(prefix, key),
+                key,
+                rootKey,
+                changer,
+                listenOnly
+        );
 
         this.readOnly = readOnly;
-        this.injectedNameField = injectedNameField;
+
+        this.injectedNameField = INJECTED_NAME.equals(key);
+        this.internalIdField = INTERNAL_ID.equals(key);
     }
 
     /** {@inheritDoc} */
     @Override
     public T value() {
         if (injectedNameField) {
+            // In this case "refreshValue()" is not of type "T", but an 
"InnerNode" holding it instead.
+            // "T" must be a String then, this is guarded by external 
invariants.
             return (T) ((InnerNode) 
refreshValue()).getInjectedNameFieldValue();
+        } else if (internalIdField) {
+            // In this case "refreshValue()" is not of type "T", but an 
"InnerNode" holding it instead.

Review comment:
       If it is not used correctly, an **ClassCastException** will be thrown, 
if it makes sense to add **assert**?




-- 
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]


Reply via email to