ObjectFilter Test Object Model
Just to verify there is no magic going on in the objects themselves:
The aspects handle the filtering, not the classes. They are ignorant of the filter. Also, they are unaffected by it:
public void testBlockReference()
{
Filter filter = Filter.instance();
filter.setActor(new Object());
filter.addRules(Teacher.class, new Rules()
{
public boolean allow(Object actor, Object instance)
{
return false;
}
});
Teacher mr_brown = new Teacher("Mr. Brown");
ClassRoom english = new ClassRoom(mr_brown);
assertNull(english.getTeacher());
filter.clearActor();
assertEquals(mr_brown, english.getTeacher();
}
By default, if no actor is set nothing is filtered (this is really important).