ptupitsyn commented on code in PR #2935:
URL: https://github.com/apache/ignite-3/pull/2935#discussion_r1420406203
##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/marshaller/asm/ObjectMarshallerCodeGenerator.java:
##########
@@ -57,15 +57,22 @@ class ObjectMarshallerCodeGenerator implements
MarshallerCodeGenerator {
ObjectMarshallerCodeGenerator(
MarshallerColumn[] marshallerColumns,
- Class<?> targetClass,
+ PojoMapper<?> mapper,
int firstColIdx
) {
this.columns = marshallerColumns;
- this.targetClass = targetClass;
+ this.targetClass = mapper.targetType();
columnAccessors = new ColumnAccessCodeGenerator[columns.length];
- Map<String, Field> flds =
Arrays.stream(targetClass.getDeclaredFields())
- .collect(Collectors.toMap(f -> f.getName().toUpperCase(),
Function.identity()));
+ Map<String, Field> flds = new HashMap<>();
+ for (String fieldName : mapper.fields()) {
+ try {
+ Field field = mapper.targetType().getDeclaredField(fieldName);
+ flds.put(fieldName.toUpperCase(), field);
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
Review Comment:
We don't have an error code for this, and I'm not sure if we need one.
Replaced with `IllegalArgumentException` to match the behavior in other
places in this class, added an explanation.
--
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]