podam icon indicating copy to clipboard operation
podam copied to clipboard

Exclude some attributes

Open sayadi opened this issue 9 years ago • 2 comments

To avoid circular filling (and eventually a StackOverflow error), or for any other reason, it would be helpful to have the ability to exclude some attributes from being filled.

A common scenario in POJOs modeling tables in a relational database is some classes will reference each other in a ManyToMany relationship:

public ClassA {
   // Annotations for many to many relationship
   ClassB b;
}
public ClassB {
   // Annotations for many to many relationship
   ClassA a;
}

sayadi avatar Nov 19 '17 09:11 sayadi

You cannot have StackOverflow error as Podam will stop after 3 levels of objects are filled.

There are several ways to do what you want, but probably the best one consist of overriding boolean ClassAttributeApprover.approve(ClassAttribute attribute) in DefaultClassInfoStrategy (or whatever ClassInfoStrategy you are using).

daivanov avatar Nov 27 '17 12:11 daivanov

Closing this as this is not an issue.

daivanov avatar Nov 27 '17 12:11 daivanov