I am looking for some wicket best practices tips.
I am refactoring a wicket app and I have a complex model. Meaning the object for the main model is a java bean that contains properties (and getters/setters) plus it contains other beans.
The main bean is 4 levels deep with other beans. This has simplified my code a lot because I can pass the top level bean into a component and it can change everything it needs. Little by little I have been populating the various beans with helper methods (e.g. exceedsMaximum(), isNull(), etc.).
Example:
public School {
Person principal;
List<Class> classList;
public Student findStudent(String firstName, String lastName) { ... }
}
public Class {
List<Students> studentList;
Person teacher;
String topic;
public Float calculateClassGPA() { ... }
}
public Student {
Float gpa;
Person student;
public Boolean isHonorStudent() { ... }
}
public Person {
String lastName;
String firstName;
Address address;
}
CompoundPropertyModel<School> schoolModel = new CompoundPropertyModel<School>(new School());
Is there any gotchas going down this path. Should I be concerned about the overhead of passing the main model to a lot of components? Would it be better to create a utility class for my helper methods to keep the beans pure? Any red flags here?