[jOOQ/jOOQ#15564] MutablePOJOMapper should be able to map to instance,
even if there isn't a default constructor This fixes: - [jOOQ/jOOQ#15559] KotlinGenerator - isKotlinNotNullPojoAttributes setting prevents generated DAO to set serial ID to pojo
This commit is contained in:
parent
d92b678e16
commit
6e26879228
@ -123,4 +123,16 @@ final class Cache {
|
||||
* A 2-value key for caching.
|
||||
*/
|
||||
private static record Key2(Object key1, Object key2) implements Serializable {}
|
||||
|
||||
/**
|
||||
* Create a single-value or multi-value key for caching.
|
||||
*/
|
||||
static final Object key(Object key1, Object key2, Object key3) {
|
||||
return new Key3(key1, key2, key3);
|
||||
}
|
||||
|
||||
/**
|
||||
* A 3-value key for caching.
|
||||
*/
|
||||
private static record Key3(Object key1, Object key2, Object key3) implements Serializable {}
|
||||
}
|
||||
@ -413,7 +413,9 @@ public class DefaultRecordMapper<R extends Record, E> implements RecordMapper<R,
|
||||
|
||||
// [#1340] Allow for using non-public default constructors
|
||||
try {
|
||||
MutablePOJOMapper m = new MutablePOJOMapper(new ConstructorCall<>(accessible(type.getDeclaredConstructor())), instance);
|
||||
MutablePOJOMapper m = instance != null
|
||||
? new MutablePOJOMapper(null, instance)
|
||||
: new MutablePOJOMapper(new ConstructorCall<>(accessible(type.getDeclaredConstructor())), null);
|
||||
|
||||
// [#10194] Check if the POJO is really mutable. There might as well
|
||||
// be a no-args constructor for other reasons, e.g. when
|
||||
|
||||
@ -4336,7 +4336,7 @@ final class Tools {
|
||||
}
|
||||
|
||||
return result;
|
||||
}, REFLECTION_CACHE_GET_ANNOTATED_MEMBERS, () -> Cache.key(type, name));
|
||||
}, REFLECTION_CACHE_GET_ANNOTATED_MEMBERS, () -> Cache.key(type, name, makeAccessible));
|
||||
}
|
||||
|
||||
private static final boolean namesMatch(String name, String annotation) {
|
||||
@ -4371,7 +4371,7 @@ final class Tools {
|
||||
result.add(accessible(member, makeAccessible));
|
||||
|
||||
return result;
|
||||
}, REFLECTION_CACHE_GET_MATCHING_MEMBERS, () -> Cache.key(type, name));
|
||||
}, REFLECTION_CACHE_GET_MATCHING_MEMBERS, () -> Cache.key(type, name, makeAccessible));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4422,7 +4422,7 @@ final class Tools {
|
||||
}
|
||||
|
||||
return SourceMethod.methods(set);
|
||||
}, REFLECTION_CACHE_GET_ANNOTATED_SETTERS, () -> Cache.key(type, name));
|
||||
}, REFLECTION_CACHE_GET_ANNOTATED_SETTERS, () -> Cache.key(type, name, makeAccessible));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4473,7 +4473,7 @@ final class Tools {
|
||||
}
|
||||
|
||||
return null;
|
||||
}, REFLECTION_CACHE_GET_ANNOTATED_GETTER, () -> Cache.key(type, name));
|
||||
}, REFLECTION_CACHE_GET_ANNOTATED_GETTER, () -> Cache.key(type, name, makeAccessible));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4510,7 +4510,7 @@ final class Tools {
|
||||
}
|
||||
|
||||
return SourceMethod.methods(set);
|
||||
}, REFLECTION_CACHE_GET_MATCHING_SETTERS, () -> Cache.key(type, name));
|
||||
}, REFLECTION_CACHE_GET_MATCHING_SETTERS, () -> Cache.key(type, name, makeAccessible));
|
||||
}
|
||||
|
||||
|
||||
@ -4545,7 +4545,7 @@ final class Tools {
|
||||
return accessible(method, makeAccessible);
|
||||
|
||||
return null;
|
||||
}, REFLECTION_CACHE_GET_MATCHING_GETTER, () -> Cache.key(type, name));
|
||||
}, REFLECTION_CACHE_GET_MATCHING_GETTER, () -> Cache.key(type, name, makeAccessible));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user