Nader Aeinehchi wrote:
> Dear Qi4j developers
>
> Your work is impressive!
>
> When analyzing ImmutableProperty, I crossed a couple of issues:
>
> 1. ImmutableFacade throws an IllegalArgumentException in the setter 
> method.  Perhaps it should rather throw an IllegalStateException to 
> indicate that the state of the object cannot be modified once the object 
> is fully populated?
>
>   
  Another sensible alternative would be UnsupportedOperationException, 
it signals that the operation is simply not there.
  IllegalStateException also makes sense, but for ordinary clients of 
immutable objects, it's actually a little odd to talk about states 
because there is supposed to be only one, immutable state.

 If the object undergoes other states immediately after its creation and 
before it's exposed to its clients, this is not very relevant for the 
clients.

/Niklas


> <code>
>     public void set( T newValue )
>         throws IllegalArgumentException
>     {
>         throw new IllegalArgumentException( "Property '" + 
> qualifiedName() + "' is immutable." );
>     }
> </code>
>
> 2. Perhaps the hierarchy of Property and ImmutableProperty should be 
> re-considered?  Should a property always have a setter?  Perhaps 
> MutableProperty and ImmutableProperty should inherit from a Property?
>
> Best regards
> Nader Aeinehchi
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
>   


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

Reply via email to