Niclas Hedhman wrote:
> Gang,
>
> I promised to write some more complex testcases for Alin's Index/Query
> engine, and wanted to do;
>
> @Mixins( PasswordValue.PasswordMixin.class )
> public interface PasswordValue extends Password, Initializable, ValueComposite
> {
> class PasswordMixin
> implements Password
> {
> @This private PasswordState state;
>
> public boolean isValid( String candidate )
> {
> return state.passPhrase().get().equals( candidate );
> }
> }
>
> interface PasswordState
> {
> @Queryable( false )
> Property<String> passPhrase();
> }
> }
>
> which I think is a pretty neat way to hide the password state behind a
> facade. BUT, then there is currently no way to initialize the private
> mixin of the PasswordValue composite.
>
> ValueBuilder has a prototype() method for the public view, but no
> equivalent of stateFor() of regular composites, which I think it still
> should have.
I'm not really fond of this at all. You are putting way too much stuff
into a dumb value container. isValid() should be in the Entity that
holds this PasswordValue. The state of a Value should be exposed
directly, i.e. no private stuff, so no need for equivalent of stateFor().
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev