Exclude attributes without using annotations
It would be nice to provide a mechanism where excluded attributes could be provided by the strategy without having to annotate them, perhaps by returning excluded attribute names.
Could you please give an overview of the background. Why do you exclude attributes? They don't work, heavy to fill, maybe some other reason?
On Thursday 26 Feb 2015 04:50:19 Daniil Ivanov wrote:
Could you please give an overview of the background. Why do you exclude attributes? They don't work, heavy to fill, maybe some other reason?
Reply to this email directly or view it on GitHub: https://github.com/mtedone/podam/issues/80#issuecomment-76172636
Sure, we're writing a Dao test that generates a random object graph using Podam, saves it, loads it back and makes sure it hasn't changed.
In the application logic, the object is mostly populated on one flow and then a later message on another flow populates one of the child objects on the graph. We'd like to be able to test the whole object graph with and without this child object generated to ensure the Dao still works in both cases.
I think it might be the same concept as transient variables. It could be a good idea
On Thursday, February 26, 2015, Daniil Ivanov [email protected] wrote:
Could you please give an overview of the background. Why do you exclude attributes? They don't work, heavy to fill, maybe some other reason?
— Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/80#issuecomment-76172636.
So PODAM produces a object graph with all nodes filled (or not?).
Then instead of setting some child to null with something like this pojo.getNode().getAnotherNode().getOtherNode.setChild(null), you want PODAM to produce object graph with child attribute filled and another time without it?
That's not what I meant. Podam should behave as is by default but if there was a way to instruct it not to fill only certain attributes on an exception basis (I think we have an Attribute...data structure that maybe we could leverage) it could be useful. But it should be users that would need to set that data structure according to their needs. Podam by default should fill in all attributes.
On Thursday, February 26, 2015, Daniil Ivanov [email protected] wrote:
So PODAM produces a object graph with all nodes filled (or not?). Then instead of setting some child to null with something like this pojo.getNode().getAnotherNode().getOtherNode.setChild(null), you want PODAM to produce object graph with child attribute filled and another time without it?
— Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/80#issuecomment-76216992.
As use-case was stated (maybe it's more complex in reality?) setAttribute(null) does the trick. Doing it through DataProviderStrategy will method addExcludedAttibute(Class<?>, String attributeName); cause the twice larger code: two lines instead of one. Aditionally, one will be relying on very complicated solution (PODAM) instead of very simple and thus robust solution such as setter.
Also term object graph concerns me. Object graph typically means something like
class Node {
String attribute;
List<Node> children;
}
So if one tells PODAM to exclude attribute "attribute" all object graph's classes won't have it set. I don't think this is what is desired here.
Fixed in PODAM 5.2.0.
So how can I do that? Is there any examples for this? @daivanov