-
Notifications
You must be signed in to change notification settings - Fork 75
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
Need something better than toString for converting args #22
Comments
Hi @massfords , We already Identified this issue and currently in progress of developing the solution. We thought of using pluggable serializer to extract object to relevant audit record based on annotations in the object fields (ex: MyDTO). I have developed below couple of serializes similar to old toString implementation. Please refer below implementations. Using this method, users are able to plug their own serializer implementation based on the requirement (Ex: JSONable, XML). then you don't need to implement a custom a annotation transformer What do you think. |
A pluggable serializer seems like the right approach. I took a quick look at the source. I don't see a way to configure the serializer yet but I'm guessing this is still a work in progress. |
This issue is resolved. Fixes are available in Audit4j 2.4.1-RC1 release @massfords Please test and verify. |
This issue is fixed in 2.4.1 |
Very nice library!
The conversion of the method args to a List is based on the arg's toString() implementation. It would be nice to support a pluggable conversion from object to a String or even support producing multiple Field's from a single argument.
Consider the following case:
In this case, I'd like to record a couple of different fields from the MyDTO arg as opposed to relying solely on its toString() implementation.
I'm thinking I can add the behavior I want by writing my own version of AnnotationTransformer and then using it in an AuditOutputStream but it would be nice if this had a declarative / annotation driven solution. For spring users in particular, it would be great to have the option of an annotation that produced a List using different names and SpEL (spring expression language). For example, I could annotate the above method with an array of annotations each one having a name and SpEL that would extract the field I want to include in the AuditEvent.
The text was updated successfully, but these errors were encountered: