tkalkirill commented on a change in pull request #290:
URL: https://github.com/apache/ignite-3/pull/290#discussion_r699019105
##########
File path:
modules/configuration/src/main/java/org/apache/ignite/internal/configuration/asm/ConfigurationAsmGenerator.java
##########
@@ -431,26 +460,27 @@ else if (isConfigValue(schemaField))
/**
* Implements default constructor for the node class. It initializes
{@code _spec} field and every other field
* that represents named list configuration.
+ *
* @param classDef Node class definition.
- * @param schemaClass Configuration Schema class.
- * @param specField Field definition for the {@code _spec} field of the
node class.
- * @param schemaFields Configuration Schema class fields.
+ * @param specFields Definition of fields for the {@code _spec#} fields of
the node class.
+ * Mapping: configuration schema class -> {@code _spec#} field.
+ * @param schemaFields Fields of the schema and its extensions.
* @param fieldDefs Field definitions for all fields of node class
excluding {@code _spec}.
*/
private void addNodeConstructor(
ClassDefinition classDef,
- Class<?> schemaClass,
- FieldDefinition specField,
- Field[] schemaFields,
+ Map<Class<?>, FieldDefinition> specFields,
+ Set<Field> schemaFields,
Map<String, FieldDefinition> fieldDefs
) {
MethodDefinition ctor = classDef.declareConstructor(of(PUBLIC));
// super();
ctor.getBody().append(ctor.getThis()).invokeConstructor(InnerNode.class);
- // this._spec = new MyConfigurationSchema();
- ctor.getBody().append(ctor.getThis().setField(specField,
newInstance(schemaClass)));
+ // this._spec# = new MyConfigurationSchema();
+ for (Map.Entry<Class<?>, FieldDefinition> e : specFields.entrySet())
+ ctor.getBody().append(ctor.getThis().setField(e.getValue(),
newInstance(e.getKey())));
Review comment:
It looks like optimization, I propose to do it in a separate ticket.
--
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]