Lifecycle is only for entities, not values.

But for RouteSpecification, isn't there some method like satisfies()
or other 'business logic', which needs a mixin, which can implement
the Initializable method??
Otherwise, need to extend Initializable in the interface.

Cheers
Niclas

On Mon, Jan 24, 2011 at 5:57 AM, Marc Grue <[email protected]> wrote:
> Hi Niclas,
>
> Thank you for your suggestion! I haven't had time to put it together yet, but 
> I'll have a go at it during the week (busy schedule).
>
> What I want to do is to have a RouteSpecification ValueComposite to enforce 
> that
> @ Immutable Property<Location> origin()
> !=
> @Immutable Property<Location> destination()
> upon instantiation (?) of the ValueComposite so that you can't create a 
> RouteSpecification that is in an invalid state. Would you place such a check 
> in the LifeCycle create method according to your suggestion too? Or is there 
> a much simpler way to enforce unequality between two properties in a 
> ValueComposite?
>
> Cheers,
> Marc
>
> On 13/01/2011, at 01.09, Niclas Hedhman wrote:
>
>> On Thu, Jan 13, 2011 at 1:34 AM, Marc Grue <[email protected]> wrote:
>>> On 12/01/2011, at 01.41, Niclas Hedhman wrote:
>>>> The handling of Property methods is not special hard-coded internals.
>>>> If you look at Composite type, you will see that it has a
>>>> PropertyMixin declared, which you can replace with your own
>>>> implementation. So, I suggest that the Mixin extends PropertyMixin and
>>>> then implements Lifecycle, that should work.
>>>
>>> Since PropertyMixin is final I can't do:
>>
>> Ok, I didn't recalled that. Class isn't bigger than you can clone it
>> source wise... Isn't it beautifu????!??
>>
>> @AppliesTo( { PropertyMixin.PropertyFilter.class } )
>> public final class MyPropertyMixin
>>    implements InvocationHandler, Lifecycle
>> {
>>    @State
>>    private StateHolder state;
>>
>>    public Object invoke( Object proxy, Method method, Object[] args )
>>        throws Throwable
>>    {
>>        return state.getProperty( method );
>>    }
>>
>>    // + Lifecycle your methods
>> }
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>



-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I live here; http://tinyurl.com/3xugrbk
I work here; http://tinyurl.com/24svnvk
I relax here; http://tinyurl.com/2cgsug

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

Reply via email to