- Oct 30, 2008
- 27,024
- 79
- 86
I don't normally ask questions here, but figured I'd give it a shot because nobody I work with can answer the question I have.
In Dozer is there a way to map an property of an object, or more specifically, exclude said property?
Here is what I am trying, and this is not working.
Now, I believe my problem lies in them being named exactly the same, but I would prefer not to change that. I am really just trying to save on data being moved around, as there is no reason for me to be passing objectIwantExclude, because it contains a lot of information I otherwise don't need. My passedObject contains a lot of other fields I do need though.
I would also prefer not to use the wildcard = false method, due to having quite a few things being mapped properly already. I would also like to do something more elegant than making a custom-converter that just removes the information.
So, Dozer experts, am I missing something on how this is to be done, or can it just not be done this way? I have googled and the only things I can get to come up are the Dozer documentation, which isn't very helpful, and nothing else useful.
Thanks in advanced.
Update: Apparently, deep mapping does not work for objects, only fields. It works perfectly if I exclude a string or int from the passed object. Well, that is rather disappointing. =(
In Dozer is there a way to map an property of an object, or more specifically, exclude said property?
Here is what I am trying, and this is not working.
Code:
<mapping>
<class-a>modelObject</class-a>
<class-b>ObjectTO</class-b>
<field-exclude type="one-way">
<a>passedObject.objectIwantExcluded</a>
<b>passedObject.objectIwantExcluded</b>
</field-exclude>
</mapping>
Now, I believe my problem lies in them being named exactly the same, but I would prefer not to change that. I am really just trying to save on data being moved around, as there is no reason for me to be passing objectIwantExclude, because it contains a lot of information I otherwise don't need. My passedObject contains a lot of other fields I do need though.
I would also prefer not to use the wildcard = false method, due to having quite a few things being mapped properly already. I would also like to do something more elegant than making a custom-converter that just removes the information.
So, Dozer experts, am I missing something on how this is to be done, or can it just not be done this way? I have googled and the only things I can get to come up are the Dozer documentation, which isn't very helpful, and nothing else useful.
Thanks in advanced.
Update: Apparently, deep mapping does not work for objects, only fields. It works perfectly if I exclude a string or int from the passed object. Well, that is rather disappointing. =(
Last edited: