-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support class field as projection target #474
Comments
When using field injection, it should be allowed to use an abstract getter, but make a collection returned from the getter unmodifiable. If a user wants to expose the modifiable version of such a collection, the getter should be implemented manually. |
This is actually a very big task. Being able to do dirty tracking for normal classes requires quite some effort. The most important part is to avoid loading the class into a class loader, as we can't redefine it the way we'd. Class redefinition only allows to change method bodies, but not add fields/methods/superclasses. The view mapping API has to be extended to allow working with FQNs. Internally, it mustn't use class objects. Since we still need to process annotations, we'd likely need something like e.g. Jandex for type structure introspection. Next, we have to think of a different discovery mechanism for the types. The current CDI/Spring extensions rely on class objects, so these won't work for updatable normal classes. In CDI we could use the Finally, we have to do the enhancement before doing the metamodel building, as the metamodel requires the actual class objects. A java agent should make the |
Note that support for read only view was added through #1078 |
To be able to implement domain models that hide certain information it is necessary to support injection of projections into fields. Read only views can already do that via constructor injection, but it would be lot nicer to support field injection. Note that for updatable entity views, this will require bytecode analysis to capture all writes to such a field to be replaced with proper write accessors.
It should also be possible to use a normal POJO class i.e. non-abstract class which could then also change the defaults. Right now, only abstract methods are considered to be "attributes". For concrete classes it might be desireable to switch the defaults and consider all fields to be attributes unless annotated with an ignore annotation.
The text was updated successfully, but these errors were encountered: