jackson-modules-base icon indicating copy to clipboard operation
jackson-modules-base copied to clipboard

Jackson Mr Bean Bean Materializer support for toString implementation

Open softwarebrahma opened this issue 5 years ago • 1 comments

Hello Folks,

I am using Jackson Mr Bean module to construct impl classes for defined interfaces. It works great, but one problem is that it does not generate an (overridden) implementation of toString() in the impl class resulting in the inability to use it for logging.

I worked around it by using default methods, but it would be nice to have that support.

Thanks Muthu

softwarebrahma avatar Dec 11 '20 21:12 softwarebrahma

That sounds like a good improvement idea. There are couple of open questions that'd have to be defined:

  1. Applicability: strict (only if toString() explicitly overridden as "abstract" to indicate it should be generated) or looser (if abstract or if target is interface)? Or something more customizable (specifically should not override explicit implementation from something above java.lang.Object, I assume?)
  2. Implementation: what would be usable implementation, how to configure? Use a templating of some kind? (generation code does not have very good understanding of POJO semantics so it cannot implement much of logic, and toString() specifically is passed no context of any kind so it cannot serialize as json or call any Jackson functionality)

cowtowncoder avatar Dec 24 '20 02:12 cowtowncoder