I have java classes like this :
@Data
public class Lead {
private A a;
...
}
@Data
public class A {
private B b;
private String c;
private List<Integer> d;
}
@Data
public class B {
private String e;
private String f;
}
I have a mapper method with annotation like this :
@FieldPermissionAnnotation("a")
public A fetchA(//Some DB Entities) {
A a = new A();
...
a.setB(fetchB());
...
a.setC(fetchC());
...
a.setD(fetchD());
}
My FieldPermissionAspect fetches the permission-field mapping from db for a user and sets field to null if user does not have permission for given field.
I get a list of string field hierarchy like this :
["a-b-e", "a-b-f", "a-c", "a-d"]
I want to set b, c, d to null using @Around around their respective setters inside the fetchA() method. Is it feasible using AspectJ and spring? How do I access the setters for b, c, d inside the fetchA() method?