Copilot commented on code in PR #6656: URL: https://github.com/apache/ignite-3/pull/6656#discussion_r2388169842
########## migration-tools/modules/migration-tools-commons/src/main/java/org/apache/ignite/migrationtools/types/InspectedField.java: ########## @@ -0,0 +1,159 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.migrationtools.types; + +import java.util.Objects; +import org.jetbrains.annotations.Nullable; + +/** Holds information about how a field should be persisted. */ +public class InspectedField { + @Nullable + private final String fieldName; + + private final String typeName; + + private final InspectedFieldType fieldType; + + private final boolean nullable; + + private final boolean hasAnnotation; + + /** + * Default constructor. + * + * @param fieldName Name of the field. May be null for Primitive and Array fields. + * @param typeName Name of the field class, usually from {@link Class#getName()} + * @param fieldType Field type. + * @param nullable Whether the field is nullable or not. + * @param hasAnnotation Whether the field was annotated with a 'QuerySqlField'. + */ + private InspectedField( + @Nullable String fieldName, + String typeName, + InspectedFieldType fieldType, + boolean nullable, + boolean hasAnnotation + ) { + this.fieldName = fieldName; + this.typeName = typeName; + this.fieldType = fieldType; + this.nullable = nullable; + this.hasAnnotation = hasAnnotation; + } + + /** + * Factory method for primitive and array fields. + * + * @param typeName Type name. + * @param fieldType Field type. + * @return The new InspectedField instance. + */ + public static InspectedField forUnamed(String typeName, InspectedFieldType fieldType) { Review Comment: The method name `forUnamed` contains a typo. It should be `forUnnamed` with double 'n'. ```suggestion public static InspectedField forUnnamed(String typeName, InspectedFieldType fieldType) { ``` ########## migration-tools/modules/migration-tools-commons/src/test/java/org/apache/ignite/migrationtools/types/TypeInspectorTest.java: ########## @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.migrationtools.types; + +import static org.apache.ignite.migrationtools.types.InspectedField.forNamed; +import static org.apache.ignite.migrationtools.types.TypeInspector.inspectType; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.params.provider.Arguments.arguments; + +import java.sql.Timestamp; +import java.util.List; +import java.util.stream.Stream; +import org.apache.ignite.examples.model.Address; +import org.apache.ignite.examples.model.Organization; +import org.apache.ignite.examples.model.OrganizationType; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +class TypeInspectorTest { + @ParameterizedTest + @MethodSource("primitiveTypes") + void testPrimitiveFieldType(Class<?> primitiveKlass, String typeName) { + List<InspectedField> inspectedTypes = inspectType(primitiveKlass); + + var expected = InspectedField.forUnamed(typeName, InspectedFieldType.PRIMITIVE); Review Comment: The method name `forUnamed` contains a typo. It should be `forUnnamed` with double 'n'. -- 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]
