Gang, The Chronos development is surfacing some issues about Value Objects, and their particular nature.
For instance, look at the difference between; public interface PersonEntity extends EntityComposite, HasName {} public interface StreetComposite extends Composite, HasName {} and public interface HasName { String getName(); void setName( String name ); } The issues is that HasName.setName() should exist for the PersonEntity, but should not exist for the StreetComposite value object, since the VO should be immutable. We could do something like; public interface PersonEntity extends EntityComposite, Nameable {} public interface StreetComposite extends Composite, Name {} public interface Nameable { Name getName(); void setName( Name name ); } public interface Name { String getName(); } public class NameBean implements Name { private String name; public NameBean( String name ) { this.name = name; } public String getName() { return name; } } So that if you want to change the Name of the Person, you would need to do; Person p = ... p.setName( new NameBean( "Niclas" ) ); but, retrieval is ugly like nothing else... Person p = ... String name = p.getName().getName(); Not sure I like that. We could also separate the setter interface from the getter interface; public interface PersonEntity extends EntityComposite, Name, NameSettable {} public interface StreetComposite extends Composite, Name {} public interface Name { String getName(); } public interface NameSettable { void setName( String name ); } A lot better, but then we would need some form of explicit support in Qi4j Core that two separate mixins are sharing the same member. Perhaps we could instead do; @ImplementedBy( ImmutableName.class ) public interface Name { String getName(); } @ImplementedBy( MutableName.class ) public interface NameSettable extends Name { void setName( String name ); } and rely on that the Mutable implementation would be selected. Any thoughts?? Cheers -- Niclas Hedhman, Software Developer I live here; http://tinyurl.com/2qq9er I work here; http://tinyurl.com/2ymelc I relax here; http://tinyurl.com/2cgsug _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general