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
Motivation:
We want to allow some degree of extensibility in the mapper. In
particular, it would be nice if a custom mapper extension could handle
new result types for DAO methods (e.g. `@Select`), without having to
rewrite the whole method generator.
Modifications:
Extract a superinterface DaoReturnTypeKind from the current enum.
Introduce a pluggable DaoReturnTypeParser in CodeGeneratorFactory.
Modify DAO method generators, so that the set of supported return type
kinds can be customized by overriding a method.
Result:
To support new return types, downstream projects will:
- write their own implementation of DaoReturnTypeKind (most likely as
another enum)
- write their own DaoReturnTypeParser implementation
- extend the default method generators to override
getSupportedReturnTypes()
- write their own CodeGeneratorFactory to return all those custom
elements.
Copy file name to clipboardExpand all lines: mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/CodeGeneratorFactory.java
Copy file name to clipboardExpand all lines: mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/DefaultCodeGeneratorFactory.java
Copy file name to clipboardExpand all lines: mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoDeleteMethodGenerator.java
Copy file name to clipboardExpand all lines: mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoGetEntityMethodGenerator.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ public Optional<MethodSpec> generate() {
94
94
// Validate the return type. Make sure it matches the parameter type
0 commit comments