You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(object-mapping): try making record components accessible (#1681)
In some cases reading components of `record` may fail as their accessors may not be accessible. This update makes sure the driver tries to make them accessible. For instance, this is useful when using local `record` in a stricter runtime. The `ObjectMappingTests` actually had a test for this, but it did not fail when it was run as a unit test. The tests have been moved to integration tests without any other update.
@@ -356,6 +369,7 @@ public static Value value(double... input) {
356
369
357
370
/**
358
371
* Returns a value from float vararg.
372
+
*
359
373
* @param input the float value(s)
360
374
* @return the value
361
375
*/
@@ -368,6 +382,7 @@ public static Value value(float... input) {
368
382
369
383
/**
370
384
* Returns a value from list of objects.
385
+
*
371
386
* @param vals the list of objects
372
387
* @return the value
373
388
*/
@@ -379,6 +394,7 @@ public static Value value(List<Object> vals) {
379
394
380
395
/**
381
396
* Returns a value from iterable of objects.
397
+
*
382
398
* @param val the iterable of objects
383
399
* @return the value
384
400
*/
@@ -388,6 +404,7 @@ public static Value value(Iterable<Object> val) {
388
404
389
405
/**
390
406
* Returns a value from iterator of objects.
407
+
*
391
408
* @param val the iterator of objects
392
409
* @return the value
393
410
*/
@@ -401,6 +418,7 @@ public static Value value(Iterator<Object> val) {
401
418
402
419
/**
403
420
* Returns a value from stream of objects.
421
+
*
404
422
* @param stream the stream of objects
405
423
* @return the value
406
424
*/
@@ -463,14 +481,17 @@ public static Value value(Stream<Object> stream) {
463
481
* limitations on how those are supported by the database. Please read the Neo4j Cypher Manual for more up-to-date
464
482
* details. For example, at the time of writing, it is not possible to store maps as properties
465
483
* (see the following <a href="https://neo4j.com/docs/cypher-manual/current/values-and-types/property-structural-constructed/#constructed-types">page</a>).
484
+
* <p>
485
+
* If accessors for record components are not accessible, the driver will try to make them accessible using
486
+
* {@link AccessibleObject#trySetAccessible()} and will emit an error if this does not succeed.
466
487
*
467
488
* @param record the record to map
468
489
* @return the map value
490
+
* @throws ClientException when mapping fails
469
491
* @see TypeSystem#MAP()
470
492
* @see java.lang.Record
471
493
* @see java.lang.reflect.RecordComponent
472
494
* @see Property
473
-
* @throws ClientException when mapping fails
474
495
* @since 5.28.5
475
496
*/
476
497
@Preview(name = "Object mapping")
@@ -483,11 +504,16 @@ public static Value value(java.lang.Record record) {
0 commit comments