404-not-find / orika

Automatically exported from code.google.com/p/orika
2 stars 0 forks source link

Custom converter doesn't work with RegexPropertyResolver #125

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have a codebase where property accessors are in the form of "property()" 
instead of "getProperty()".  I tried mapping them using a 
RegexPropertyResolver, which works for mappings that use default convertors, 
but doesn't when I try to register a custom converter.  I've created a 
contrived example to demonstrate, which is attached.  The output from running 
the example is:

source: Source [name=Fred, description=Hungry, numbers=[1, 2, 3]]
destination: Destination [name=Fred, description=Hungry, numberSet=null]

Note, when I change the property accessors from "property()" to "getProperty()" 
the code works properly.  However, since I'm trying to use Orika on an a very, 
very large existing codebase, this is not an option for me.

Original issue reported on code.google.com by brucedfa...@gmail.com on 31 Aug 2013 at 6:49

Attachments:

GoogleCodeExporter commented 8 years ago
Of course this is not an option :)
In fact, there was a small error in your code, you should use 
new RegexPropertyResolver("([\\w]+)", "set([\\w]+)", true, true))
(not set(..)Property)) 

Original comment by elaat...@gmail.com on 2 Sep 2013 at 9:09