On Wed, Apr 9, 2008 at 11:46 AM, Sonny Gill <[EMAIL PROTECTED]> wrote:

>  Do you find it a bit odd that PropertyInstance implements
>  ImmutabeProperty, but it can be set?

Well, that is wrong question. It should be "Why does ImmutableProperty
have set() method?"

Excellent question; It is so that we can do the CompositeBuilder
initialization stuff.

public interface Human
{
    ImmutableProperty<Personality> personality();
}

CompositeBuilder<Human> builder = factory.newCompositeBuilder( Human.class );
Human cheerfulPrototype = builder.stateOfComposite( Human.class );
cheerfulPrototype.set( happyPersonality );
Human john = builder.newInstance();
john.personality().set( grumpyPersonality ); /// throws Exception

As you can see, it is a "hack" for us to allow doing prototype
initialization, but once the instance is created, a runtime exception
will be thrown.


Cheers
Niclas

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to