Propoid implements Aspect { public Iterable<Aspect> aspects() { return new Iterable<Aspect>() { @Override public Iterator<Aspect> iterator() { return new AspectIterator(); } }; }  T onGet(Property<T> property, T value); T onSet(Property<T> property, T value); Meta meta(); Iterable<Aspect> aspects(); Iterable<Property<?>> properties();  }
@Test public void testAspects() throws Exception { Foo foo = new Foo(); TestAspect aspect = new TestAspect(foo); aspect.reset(); foo.bar.setInternal("BAR"); assertFalse(aspect.setCalled); foo.bar.getInternal(); assertFalse(aspect.getCalled); aspect.reset(); foo.bar.set("BAR"); assertTrue(aspect.setCalled); foo.bar.get(); assertTrue(aspect.getCalled); Iterator<Aspect> aspects = foo.aspects().iterator(); assertTrue(aspects.hasNext()); assertEquals(aspect, aspects.next()); aspects.remove(); assertTrue(aspects.hasNext()); aspects.next(); assertFalse(aspects.hasNext()); aspect.reset(); foo.bar.set("BAR"); assertFalse(aspect.setCalled); foo.bar.get(); assertFalse(aspect.getCalled); }