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
DATAGRAPH-1390 - Provide attribute specific conversions.
This introduces the idea of a `Neo4jPersistentPropertyConverter`, a `Neo4jPersistentPropertyConverterFactory` and an annotation `@ConvertWith`.
The annotation can be applied to fields and other annotations.
It is used to indicate that a given `Neo4jPersistentProperty` needs a custom conversion for reads and writes and overwrides all existing converters.
The annotation allows to specifiy the converter through `converter()` and an optional factory.
The default `Neo4jPersistentPropertyConverterFactory` will just try to instantiate the given converter class.
More sophisticated solutions need dedicated factories.
To make the factories work possible, the whole persistent property is passed as a construction parameter, so that the `@ConvertWith` annotation
or any other meta-annotated annotations can be retrieved.
In the progress of implementing this, the `Neo4jEntityConverter` has been stripped of its duties to convert single values.
Instead, a `Neo4jConversionService` has been introduced that orchestrates the underlying spring service and possible overrides.
The conversion will applied at all places where a persistent property can be deduced, either from the model or from parameters targeting the properties.
It will not be applied to parameters of string based queries or SpEL.
Copy file name to clipboardExpand all lines: etc/jqassistant/structure.adoc
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,8 +21,17 @@ RETURN p1,p2
21
21
.The public support packages must not depend directly on the mapping package
22
22
----
23
23
MATCH (a:Main:Artifact)
24
-
MATCH (a) -[:CONTAINS]-> (p1:Package) -[:DEPENDS_ON]-> (p2:Package) <-[:CONTAINS]- (a)
25
-
WHERE p1.fqn in ['org.springframework.data.neo4j.core.convert', 'org.springframework.data.neo4j.core.schema', 'org.springframework.data.neo4j.core.support', 'org.springframework.data.neo4j.core.transaction']
Copy file name to clipboardExpand all lines: src/main/asciidoc/appendix/conversions.adoc
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,6 +177,8 @@ If you require the time zone, use a type that supports it (i.e. `ZoneDateTime`)
177
177
178
178
== Custom conversions
179
179
180
+
=== For attributes of a given type
181
+
180
182
If you prefer to work with your own types in the entities or as parameters for `@Query` annotated methods, you can define and provide a custom converter implementation.
181
183
First you have to implement a `GenericConverter` and register the types your converter should handle.
182
184
For entity property type converters you need to take care of converting your type to *and* from a Neo4j Java Driver `Value`.
0 commit comments